answersLogoWhite

0

#include<stdio.h>

void main()

{

int num1, num2,res;

char ch;

printf("\n Enter the 1st operand");

scanf("%d",&num1);

printf("\n Enter the operator");

scanf("%c",&ch);

printf("\n Enter the 2nd operand");

scanf("%d",&num2);

switch(ch)

{

case '+' :res=num1+num2; break;

case '-' :res=num1-num2; break;

case '*' :res=num1*num2; break;

case '/' :res=num1/num2; break;

}

printf("\n The result of %d %d %d is =%d",num1,ch,num2,res);

}

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
More answers

main()

{

int a,b,ch;

float result;

do

{

clrscr();

printf("select the operation from list");

printf("\n 1.ADDITION \n 2.SUBSTRACTION");

printf("\n 3.MULTIPLICATION \n 4.DIVISION");

printf("\n Enter your choice:");

scanf("%d",&ch);

}

while((ch>4)(ch<1));

switch(ch)

{

case1: printf("\n enter two numbers:");

scanf("%d%d",&a,&b);

result=a+b;

printf("\n result=%f",result);

break;

case2: printf("\n enter two numbers:");

scanf("%d%d",&a,&b);

result=a-b;

printf("\n result=%f",result);

break;

case3: printf("\n enter two numbers:");

scanf("%d%d",&a,&b);

result=a*b;

printf("\n result=%f",result);

break;

case4: printf("\n enter two numbers:");

scanf("%d%d",&a,&b);

result=a/b;

printf("\n result=%f",result);

break;

}

getch();

}

User Avatar

Wiki User

14y ago
User Avatar

#include<stdio.h>

#include<conio.h>

void add()

{

int a=10,b=10,sum;

sum=a+b;

printf("%d",sum);

}

void main()

{

int ch;

clrscr();

printf("Enter your choice:-");

scanf("%d",&ch);

switch(ch)

{

case 1:

add();

break;

}

getch();

}

If you any query about C Language so replay me my email fofandi.nirav@gmail.com

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Write a C programme for arithmetic operations using menu driven?
Write your answer...
Submit
Still have questions?
magnify glass
imp