By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,640 Members | 2,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,640 IT Pros & Developers. It's quick & easy.

please help me.this what i write but it gives me error.

P: 1
/*header file declare*/

#include<stdio.h>
#include<conio.h>

void main(){
/*Declare local variable*/
char ch;
int valuea;
int valueb;
int output;

/*user enter symbol*/
printf("Enter the symbol : ");

do{
scanf("%c",&ch);

/*wrong input , will notify the user*/
if(ch!='+' && ch!='*' && ch!='-' && ch!='/'){
printf("Invalid symbol , Please enter correct symbol \n");
}
}while(ch!='+' && ch!='*' && ch!='-' && ch!='/');

/*Enter first value*/
printf("\nEnter vallue A :");
scanf("%d",&valuea);

/*Enter second value*/
printf("\nEnter vallue B :");
scanf("%d",&valueb);

/*perform operation for output*/
if(ch=='+'){
output=valuea+valueb;
}
if(ch=='-'){
output=valuea-valueb;
}
if(ch=='*'){
output=valuea*valueb;
}
if(ch=='/'){
output=valuea/valueb;
}


/*print final answer */
printf("\n\n%d %c %d = %d",valuea,ch,valueb,output);
getch();
}
Oct 6 '15 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 2,400
What error do you get?
Oct 6 '15 #2

weaknessforcats
Expert Mod 5K+
P: 9,197
Also, do you get this error when you compile the program or when you run it?
Oct 6 '15 #3

Post your reply

Sign in to post your reply or Sign up for a free account.