C program for add,sub,mul,div,rem, C/C++ Programming

Assignment Help:

C Program for ADD,SUB,MUL,DIV,REM

void main()

{

 

int a,b,c,ch=0;

          clrscr();

          while(ch<=5)

          {

printf(" \n\n 1:- For To Add\n 2:- For To Sub\n 3:- For To Mul\n 4:- For To Div\n 5:- For To Rem\n 6:- For To Exit");

          printf("\nENTER YOUR CHOICE=");

          flushall();

          scanf("%d",&ch);

          switch(ch)

          {

                   case 1:

                             printf("ENTER THE FIRST VALUE=");

                             flushall();

                             scanf("%d",&a);

                             printf("ENTER THE SECOND VALUE=");

                             flushall();

                             scanf("%d",&b);

                             c=a+b;

                             printf("THE SUM OF %d AND %d IS=%d",a,b,c);

                             break;

 

                   case 2:

                             printf("ENTER THE FIRST VALUE=");

                             flushall();

                             scanf("%d",&a);

                             printf("ENTER THE SECOND VALUE=");

                             flushall();

                             scanf("%d",&b);

                             c=a-b;

                             printf("THE SUB OF %d AND %d IS=%d",a,b,c);

                             break;

 

                   case 3:

                             printf("ENTER THE FIRST VALUE=");

                             flushall();

                             scanf("%d",&a);

                             printf("ENTER THE SECOND VALUE=");

                             flus000hall();

                             scanf("%d",&b);

                             c=a*b;

                             printf("THE MUL OF %d AND %d IS=%d",a,b,c);

                             break;

 

          case 4:

                             printf("ENTER THE FIRST VALUE=");

                             flushall();

                             scanf("%d",&a);

                             printf("ENTER THE SECOND VALUE=");

                             flushall();

                             scanf("%d",&b);

                             c=a/b;

                             printf("THE DIV OF %d AND %d IS=%d",a,b,c);

                             break;

 

case 5:

                             printf("ENTER THE FIRST VALUE=");

                             flushall();

                             scanf("%d",&a);

                             printf("ENTER THE SECOND VALUE=");

                             flushall();

                             scanf("%d",&b);

                             c=a%b;

                             printf("THE REM OF %d AND %d IS=%d",a,b,c);

                             break;

                   }

          }

          getch();

}

OUTPUT :
1 FOR TO ADD.
2 FOR TO SUB.
3 FOR TO MUL.
4 FOR TO DIV.
5 FOR TO REM.
6 FOR TO EXIT
ENTER YOUR CHOICE: 1
ENTER 1 NO: 5
ENTER 2 NO: 5
THE SUM OF 5 AND 5 IS 10


Related Discussions:- C program for add,sub,mul,div,rem

Create a mathematical number guessing game, Create a mathematical number gu...

Create a mathematical number guessing game. Have the user prompt for the number of games that they want to play. Then each game consists of the following rules. a. The computer

AREAUNDERCURVE, Write a program to find the area under the curve y = f(x) b...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw

What are control structures, What are control structures? - Control str...

What are control structures? - Control structures decide which instructions in program must be executed. - This implies that program flow may not necessarily move from one s

Explain protected derivation, Protected derivation In addition to doing...

Protected derivation In addition to doing private and public derivations, you may also do a protected derivation. In this situation :   The private members inherited

Example of switch case statement, #include #include #include void* m...

#include #include #include void* memorycopy (void *des, const void *src, size_t count) {   size_t n = (count + 7) / 8;   char* destination = (char *) des;   char* source =

Assignment help, #questionHi, I am looking for help with the assignment, ca...

#questionHi, I am looking for help with the assignment, can you help..

Text Editor, Add a function for saving the text stored in an array to a fil...

Add a function for saving the text stored in an array to a file. Your program must check whether or not the output file already exists, and if it does, your program must ask the us

Program to multiply 2 complex no.s - c++ program, THIS PROGRAM IS TO MULTIP...

THIS PROGRAM IS TO MULTIPLY THE TWO COMPLEX NO.S GIVEN BY THE USER #include #include #include struct complex     {     int real;     int imag;     }; void main()  {  clrs

Monali koli

7/13/2013 2:21:15 AM

c prog convert is cpp prog

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd