Program For Addition, Subraction, Multiplication & Division

Learn and Trouble Shoot Problems Related to C-Language here.

Program For Addition, Subraction, Multiplication & Division

Unread postby rajeevmahura » Thu May 22, 2008 6:21 pm

// Enter Two Variables and Fint Addition, Subtraction, Multiplication
// & Division with Using Switch Case

/* Program For Addition, Subraction, Multiplication & Division */
#include<stdio.h>
#include<conio.h>
void main()
{
int cho,num1,num2,num3;
clrscr();
printf("Enter Any 1th Number ");
scanf("%d",&num1);

printf("Enter Any 2nd Number ");
scanf("%d",&num2);

printf("\nOptions: 1. Addition \n\t 2. Subtraction \n\t ");
printf("3. Multiplication \n\t 4. Division ");

printf("\nEnter Your Choice ");
scanf("%d",&cho);

switch(cho)
{
case 1 : num3=num1+num2;
printf("Sum:- %d + %d = %d",num1,num2,num3);break;

case 2 : num3=num1-num2;
printf("Subtraction:- %d - %d = %d",num1,num2,num3);break;

case 3 : num3=num1*num2;
printf("Multiplication:- %d * %d = %d",num1,num2,num3);break;

case 4 : num3=num1/num2;
printf("Division:- %d / %d = %d ",num1,num2,num3);break;

default : printf("Entered Choice is Incurrect ");break;
}
getch();
}
/*-------------------------------------------------------------------------------
Input:- Enter Any 1th Number 5
Enter Any 2nd Number 8

Options: 1. Addition
2. Subtraction
3. Multiplication
4. Division

Enter Your Choice 3

Output:- Multiplication:- 5 * 8 = 40
*/
--Regards--
Rajeev Mahura
Servers & Storage Professional
http://about.me/rajeevmahura
User avatar
rajeevmahura
 
Posts: 144
Joined: Tue May 20, 2008 5:22 pm
Location: Bangalore | New Delhi
Full Name: Rajeev Mahura
Date Of Birth: 15 Jan 1984
Address: New Delhi
Profession: DOEACC Trainer
DOEACC Center: DOEACC DELHI
Mobile No: 0

Return to C-Language

Who is online

Users browsing this forum: No registered users and 2 guests

cron