Subscribe for more such posts..

Dear Reader...
I hope u are like my posts. If so then please don't forget to like , share and follow my blog for more such posts ,also feel free to write suggestions in the comment box given over here.

Thank you...

Search This Blog

Program to draw the calculator using the switch statements in c language.


 
#include <stdio.h> int main() { long long int f1 , f2 , f3 , n1 , n2 , f4 ; int choice; printf("-----------------Simple Calculator----------------------------------\n"); printf(" press 1 for Addition\n"); printf(" press 2 for Subtraction\n"); printf(" press 3 for Multiplication \n"); printf(" press 4 Division\n"); printf("Enter the choice: "); scanf("%d" , &choice); printf("Enter two number: "); scanf("%lld %lld" , &n1 , &n2); switch (choice){ case 1 : f1 = n1 + n2 ; printf("The sum of two number is = %lld\n" , f1); break; case 2 : f2 = n1 - n2 ; printf("The Subtraction of two number is = %lld\n" , f2); break; case 3 : f3 = n1 * n2 ; printf("The Multiplication of two number is = %lld\n" , f3); break; case 4 : f4 = n1 / n2 ; printf("The Division of two number is = %lld\n" , f4); break; } }


No comments:

Post a Comment