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

Problem : Compiler Design - Limit the methods, Rahul is a newbie to the pro...

Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with '

Described the isa and hasa class relationships. , Described the ISA and HAS...

Described the ISA and HASA class relationships. How would you apply each in a class design? A: A specialized class "is" specialization of another class and, thus, has the ISA re

Program to calculate the n factorial, Debug the following program to calcul...

Debug the following program to calculate N! #include using namespace std; main() {             int N, factorial=1;             cout             cin >> N;

Fraction coding, Create a program that asks the user for two integers which...

Create a program that asks the user for two integers which represent the numerator and denominator parts of fraction. Print out a simplification of the fraction. Example: Enter th

Describe faster ++i or i++, A: The answer to this lies actually, how they u...

A: The answer to this lies actually, how they used. Along ++i(PreIncrement) the variable is incremented and new value is returned. Thus it needs one instruction to increment the va

Program to list the cities and their states, The program will ask the user ...

The program will ask the user to enter: '1' to List the cities(and their state abbrev)  from largest to smallest (by their population) with their population '2'  to List the

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