Saturday, 16 May 2020

CALCULATOR PROGRAM IN C

AT LAST I THINK YOU GOT AN IDEA OF CODINGS. HERE I WILL TEACH YOU HOW TO CODE A PROGRAM FOR CALCULATOR BY USING THE OPERATORS ADDITION, SUBTRACTION, MULTIPLICATION AND DIVISION.

 SO HERE IS THE PROGRAM:

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c,d,e,f;
clrscr();
printf("Enter two numbers to add\n');
scanf("%d%d",&a,&b);
c=a+b;
printf("\nThe result of addition is %d",c);
printf("Enter two numbers to sub\n');
scanf("%d%d",&a,&b);
c=a-b;
printf("\nThe result of subtraction is %d",c);
printf("Enter two numbers to multiply\n');
scanf("%d%d",&e,&f);
d=e*f;
printf("\nThe result of multiplication is %d",d);
printf("Enter two numbers to division\n');
scanf("%d%d",&e,&f);
c=a/b;
printf("\nThe result of division is %d",d);
getch();
}

output:
Enter two numbers to add
5 6
The result of addition is 11

Enter two numbers to sub
6 5
The result of subtraction is 1

Enter two numbers to multiply
6 5
The result of multiplication is 30

Enter two numbers to division
6 5
The result is 1

EXPLANATION:
                THE ABOVE PROGRAM IS USED TO CALCULATE TWO NUMBERS WITH DIFFERENT OPERATIONS :

                      ADDITION.
                     
                      SUBTRACTION.

                      MULTIPLICATION.
 
                       DIVISION.

No comments:

Post a Comment

C Programming

What is DBMS in brief?

A Database Management System (DBMS) is a software suite designed to efficiently manage, organize, store, manipulate, and retrieve data. It a...