Thursday, 28 August 2014

Write a program to make a simple calculator taking input of two numbers.

SOURCE CODE

//WAP to make a simple calculator taking input of two numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int a, b, sum, sub, mul, mod ;
   float div ;
   printf("SIMPLE CALCULATOR\n\n") ;
   printf("Enter the value of A : ") ;
   scanf("%d", &a) ;
   printf("Enter the value of b : ") ;
   scanf("%d", &b) ;
   sum=a+b ;
   sub=a-b ;
   mul=a*b ;
   div=a/b ;
   mod=a%b ;
   printf("\nThe addition is %d.", sum) ;
   printf("\nThe substraction is %d.", sub) ;
   printf("\nThe multiplication is %d.", mul) ;
   printf("\nThe division is %f.", div) ;
   printf("\nThe modulus is %d.", mod) ;
   getch() ;
}


SCREENSHOT


No comments:

Post a Comment