How to Make Calculator In C Language

How to make calculatoR in C Lanuguage

#include<stdio.h>
#include<conio.h>
main()
{
float num1;
float num2;
char opt;
float result;
 clrscr();
printf("enter the first number:");
scanf("%f",&num1);
printf("enter the operation:");
scanf(" %c",&opt);
printf("enter the second number:");
scanf("%f",&num2);
switch(opt)
{
case'-':
result =num1-num2;
printf("%f",result);
break;
 case'+':
result =num1+num2;
printf("%f",result);
break;
 case'*':
result =num1*num2;
printf("%f",result);
break;
 case'/':
result =num1/num2;
printf("%f",result);
break;
default :
printf("the operator is not valid");
 }

getch();
}
#HS_Creations
#Kepp_Visiting

Comments

Popular posts from this blog

How to hack Facebook account using termux (password guessing method)

From Start To Success| A Step By Step Guide To Becoming A Profitable Amazon Seller

Bitcoin Price Prediction In 2024: Boom Or Bust?