Switch-Computer Fundamentals and Programming-Coding Assignment Solution, Exercises of Computer Engineering and Programming

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

2011/2012

Uploaded on 07/28/2012

dewansh
dewansh 🇮🇳

4.4

(10)

89 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
7
#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();
}
Switch
docsity.com

Partial preview of the text

Download Switch-Computer Fundamentals and Programming-Coding Assignment Solution and more Exercises Computer Engineering and Programming in PDF only on Docsity!

#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(); }

Switch

docsity.com