Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions C/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
| Program-67 | Program to calulate all the prime between the range of numbers includes the numbers which is provided. |
| Program-68 | Program to accept 0s and 1s as input and print if it consists 3 consecutive 0s |
| Program-69 | Program to find strong number |
| Program-70 | Program to make a simple calculator |
3 changes: 3 additions & 0 deletions C/program-70/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Program 70

C program to make simple calculator
38 changes: 38 additions & 0 deletions C/program-70/program70.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#include<stdio.h>
int main()
{
char op;
float number1,number2,result;
for(int i=0; i<5;i++)
{
printf("\nEnter\n + for Addition \n - for Subtraction \n * for Multiplication \n / for Division");
printf("\nEnter the operation you want to perform\n");
scanf("%s",&op);
printf("Enter two numbers\n");
scanf("%f %f",&number1,&number2);
switch(op)
{
case'+':result=number1+number2;
printf("Sum is %f\n",result);
break;
case'-':result=number1-number2;
printf("Difference is %f\n",result);
break;
case'*':result=number1*number2;
printf("Product is %f\n",result);
break;
case'/':if(number2==0)
{
printf("Division not possible\n");
}
else
{
result=number1/number2;
printf("Quotient is %f\n",result);
}
break;
default:printf("Enter proper input\n");
}
}
return 0;
}