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

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

Posted Date: 9/10/2012 2:21:20 AM | Location : United States





c prog convert is cpp prog
Posted by Monali koli | Posted Date: 7/13/2013 2:21:15 AM


Related Discussions:- C program for add,sub,mul,div,rem, Assignment Help, Ask Question on C program for add,sub,mul,div,rem, Get Answer, Expert's Help, C program for add,sub,mul,div,rem Discussions

Write discussion on C program for add,sub,mul,div,rem
Your posts are moderated
Related Questions

please answer the question of following Write a function that calculates the number of elapsed days between two dates. For example the days between Feb 3, 1970 and June 21, 1980? B

count the number of string in n-th padovan string

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

You are to write a C++ program which will compute the gross pay, Social Security Tax, Income Tax and net pay for an employee. The program needs to prompt for and read the employ

Q: But MFC appear to encourage the employ of catch-by-pointer; should I do the similar? A: Depends. If you're utilizing MFC and catching one of their exceptions, by all means, d


A container class is a class which is used to hold objects in external storage and memory. A container class work as a generic holder. A container class contains a predefined behav

describe how identifiers of different data type are defined using this notaion?

write a static method with one integer parameter, x that returns the value of the polynomial 3x(2)- 7x + 2