C Switch Case Program (What Do You Want to Drink?) Simple Example for bignners - HelpMeOutAlways

Friday, June 22, 2018

C Switch Case Program (What Do You Want to Drink?) Simple Example for bignners

Source Code

#include<stdio.h>

main ()
{
  int drink;
  printf ("Hello!Sir\n");
  printf ("What would you like to drink?\n");
  printf ("1.Tea\n");
  printf ("2. Coffe\n");
  printf ("Please Select (1/2):\n");
  scanf ("%d", &drink);

  switch (drink)
    {
    case 1:
      printf ("Tea! ok Sir, i will be right back ", drink);
      break;
    case 2:
      printf ("Coffe! ok Sir, i will be right back ", drink);
      break;
    }
  return 0;
}

Output

switch simple example

switch simple example


No comments:

@way2themes