Programming in C Can someone help me figure out what is wrong with my code?
Programming in C Can someone help me figure out what is wrong with my code? I am trying to create a simple calculator in C. I am using Code Blocks and my code won't build and run.
#include<stdio.h>
#include<stdlib.h>
int main()
{ int n,num1,num2,result;
char option;
do{
printf("\nwhat operation do you want to do?\n");
printf("press 1 for addition\n");
printf("press 2 for subtraction\n");
printf("press 3 for multiplication\n");
printf("press 4 for division\n");
scanf("%d",&n);
printf("please enter a number\n");
scanf("%d",&num1);
printf("please enter a second number\n");
scanf("%d,&num2);
switch(n)
{
case 1:result=num1+num2;
printf("addition of two numbers is %d,result");
break;
case 2:result=num1-num2;
printf("subtraction of two numbers is %d,result");
break;
case 3:result=num1*num2;
printf("multiplication of two numbers is %d,result");
break;
case 4:result=num1/num2;
printf("division of two numbers is %d,result");
break;
default:printf("wrong input");
}
printf("do you want to continue y/n?\n");
option=getche();
}while(option=='y');
getch();
return 0;
}
10 years ago
3
Purchase the answer to view it

- calculator.zip
Purchase the answer to view it

- calculator.zip
- Human Resource
- 2222
- The Key Concepts of Economics, for Rey Writer only
- Statics
- Expert Help
- For Wizard Kim: The Application Paper
- Click on the Solver worksheet and then set up the Solver parameters for this problem using the following guidelines You...
- Assignment 1: Discussion Question
- social psychology habits question
- Environmental science
