USER'S CHOICE POST

Internet Download Manager free download for life time activated
Top 10 software you must have in your computer/laptop/tab with free download link

Earn upto Rs. 9,000 pm checking Emails. Join now! And get Rs. 99 Instantly!

ALL THE INFORMATION GIVEN IN THIS SITE IS ONLY FOR THE LEARNING PURPOSE. WE SHOULD ALWAYS USE THE GENUINE SOFTWARE! USE OF ANY INFORMATION GIVEN HERE IS SOLELY USERS' RESPONSIBILITY!


Thursday, 7 June 2012

SWITCH CASE IMPLEMENTATION FOR FOUR FUNCTIONS

Filled under:

SWITCH CASE IMPLEMENTATION FOR FOUR FUNCTIONS

CODE:
#include<stdio.h>
#include<conio.h>
void main()
{
 int add,sub,mul,ch,num1,num2;
 float div;
 printf("press 1 for addition\n");
 printf("press 2 for subtraction\n");
 printf("press 3 for multiplication\n");
 printf("press 4 for division\n");
 printf("Enter your choice:");
 scanf("%d",&ch);
 switch(ch)
 {
 case 1:
    printf("Please Enter 2 numbers:");
    scanf("%d%d",&num1,&num2);
    add=num1+num2;
    printf("addition=%d",add);
    break;
 case 2:
    printf("Please Enter 2 numbers:");
    scanf("%d%d",&num1,&num2);
    sub=num1-num2;
    printf("subtract=%d",sub);
    break;
 case 3:
   printf("Please Enter 2 numbers:");
   scanf("%d%d",&num1,&num2);
   mul=num1*num2;
   printf("multiplication=%d",mul);
   break;
 case 4:
    printf("Please Enter 2 numbers:");
   scanf("%d%d",&num1,&num2);
   div=(float)num1/num2;
   printf("division=%0.2f",div);
   break;
default:
   printf("wrong choice");
 }
 printf("Thank you!Visit www.FreeDownloadZone.in again!")
 getch();
}


OUTPUT:
press 1 for addition
press 2 for subtraction
press 3 for multiplication
press 4 for division
Enter your choice:1
Please Enter 2 numbers 5
21
addition=26

SHARE IT WITH YOUR FRIEND!

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...


Try New Whatsapp+ latest for free with lots of new Emoticons :) , Latest Version
Download NOW