
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Kapish Gupta assigned programming task at Assam Don Bosco University. This code was developed and compiled in Borland. It includes: Switch, Choice, Device, Calculation, Subtraction, Addition, Division, Multiplication, Result
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

#include<conio.h> void main (void) { int num1,num2,choice; float num3; clrscr(); printf ("Welcome to the calculating device\nPlease enter two numbers\n"); scanf ("%d%d",&num1,&num2); printf ("Please enter the choice for calculation\n"); printf ("The choices are:\n"); printf ("For Addition press 1\nFor Subtraction press 2\nFor Multiplication press 3\nAnd for Division press 4\n"); scanf ("%d",&choice); switch (choice) { case 1: { num3=num1+num2; printf ("%f is the added result\n",num3); break; } case 2: { num3=num2-num1; printf ("%f is the subtracted result\n",num3); break; } case 3: { num3=num1*num2; printf ("%f is the multiplied result\n",num3); break; } case 4: { num3=num2/num1; printf ("%f is the quotent\n",num3); break; } } getch(); }