Powered by Blogger.

Translate

Tuesday, June 26, 2012

Home » » switch case dev c++

switch case dev c++

#include<stdio.h>
#include<conio.h>
main()
{
  int choice;
  float x,y;
  printf("Enter the value of 1st:");
  scanf("%f",&x);
  printf("Enter the vale of 2nd :");
  scanf("%f",&y);
 
  printf("1.Add\n");
  printf("2.Subtact\n");
  printf("3.Multification\n");
  printf("4.Division\n");
  printf("\n\n\nEnter your choice[1-4]: ");
  scanf("%d",&choice);
  switch(choice)
  {
                case 1:
                     printf("THE result is :%f",x+y);
                     break;
                case 2:
                     printf("The result is :%f",x-y);
                     break;
                case 3:
                     printf("The result is :%f",x*y);
                     break;
                 case 4:
                      printf("The result is :%f",x/y);
                      break;
                  default:
                          printf("unknown");
                          }
             fflush(stdin);
             getchar();
             }
                                          
Share this games :

0 comments:

Post a Comment