Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Notes On Calculator

Loading...

Published in: C / C++
704 Views

C program

Fatima J / Hyderabad

11 years of teaching experience

Qualification: M.Sc (vbs purvanchal university - 2017)

Teaches: Basic Computer, MS Office, School Level Computer, Computer Science, Mathematics, Physics, Statistics, Science, B.Sc Tuition, B.Tech Tuition

Contact this Tutor
  1. Q. Write a C program to make a calculator to perform addition, subtraction, multiplication and division. PROGRAM . #include #include #include int main() int opt; float x,y; //clrscr(); CALCULATOR printf("Enter two numbers : \n"); scanf("%f%f",&x,&y); printf("Enter numbers greater then O \n"); else printf("\n 1.Addition \t\t 2.Subtraction \t\t 3.Multiplication \t\t 4.Division \n"); printf("choose options :"); scanf("%d",&opt); switch(opt) case 1: printf("--- ADDITION printf("The result is %f\n",(x+Y));
  2. break; case 2: SUBSTRACTION printf( printf("The result is %f\n",(x-y)); break; case 3: printf("--- MULTIPLICATION printf("The result is %f\n",(x*y)); break; case 4: printf("--- DIVISION printf("The result is %f\n",(x/y)); break; printf( \n Thank you getch(); return O; OUTPUT CALCULATOR Enter two numbers 10 1 .Addition choose options :1 - ADDITION - The result is 12.eoøøøe you 2. Subtraction 3. multiplication 4. Division
  3. Enter two numbers 10 2 1. Addition choose options : 2 - SUBSTRACTION - The result is 8.eeeøøe Thank you CALCULATOR Enter two numbers 18 2 1. Addition choose options : 3 mULTIPLICATION - The result is 28.eøøøøø Enter two numbers 2. Subtraction 2 . Subtraction 10 2 1. Addition choose options - DIVISION - The result is 5. Thank 3. multiplication 3 . multiplication 3. multiplication 4. Division 4. Division 4. Division 2. Subtraction øøøøøø