Developer community
0 votes
2.4k views
asked by Guru (24.6k points) 29 51 79 | 2.4k views

1 Answer

0 votes

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c,ch;

clrscr();

printf(“\n1.add\n2.subtract\n3.multiply\n4.division\n5.remainder\n);

printf(“\nenter your choice\n”);

scanf(“%d”,&ch);

switch(ch)

{

case1:

printf(“\nenter values of a and b\n”);

scanf(“%d%d”,&a,&b);

c=a+b;

printf(“\nthe answer is %d”,c);

break;

case2:

printf(“\nenter values of a and b\n”);

scanf(“%d%d”,&a,&b);

c=a-b;

printf(“\nthe answer is %d”,c);

break;

case3:

printf(“\nenter values of a and b\n”);

scanf(“%d%d”,&a,&b);

c=a*b;

printf(“\nthe answer is %d”,c);

break;

case4:

printf(“\nenter values of a and b\n”);

scanf(“%d%d”,&a,&b);

c=a/b;

printf(“\nthe answer is %d”,c);

break;

case5:

printf(“\nenter values of a and b\n”);

scanf(“%d%d”,&a,&b);

c=a%b;

printf(“\nthe answer is %d”,c);

break;

default:

printf(“\nenter the correct choice”);

break;

}

getch();

}

Output:

1.add

2.subtract

3.multiply

4.division

5.remainder

enter your choice

2

enter the values of a and b

7

4

the answer is 3 

answered by Guru (39.1k points) 10 22 34

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked by keem Expert (13.2k points) 27 41 59 | 49 views
0 votes
1 answer
asked by keem Expert (13.2k points) 27 41 59 | 20 views
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

3,751 questions
4,046 answers
117 comments
10,709 users