#include<stdio.h>
#include<conio.h>
#include<dos.h>
main()
{
int a,b,c,number;
clrscr();
int ad() {
clrscr();
printf("Enter first number");
scanf("%d",&a);
printf("Enter second number");
scanf("%d",&b);
c=a+b;
printf("The answer is %d",c);
}
int sub() {
clrscr();
printf("Enter first number");
scanf("%d",&a);
printf("Enter second number");
scanf("%d",&b);
c=a-b;
printf("The answer is %d",c);
}
int mult() {
clrscr();
printf("Enter first number");
scanf("%d",&a);
printf("Enter second number");
scanf("%d",&b);
c=a*b;
printf("The answer is %d",c);
}
int division() {
clrscr();
printf("Enter first number");
scanf("%d",&a);
printf("Enter second number");
scanf("%d",&b);
c=a/b;
printf("The answer is %f",d);
}
int main() {
do {
ad();
sub();
mult();
division();
while(ans!=13||ans!13);
}
do {
if(number=1) {
ad();
}
else if(number==2) {
sub();
}
else if(number==3) {
mult();
}
else if(number==4) {
division();
}
ans=getche();
}
while(ans!=13||ans!13);
}
getch();
}
what wrong with my code? help me please....
tayler
0
Newbie Poster
Recommended Answers
Jump to Post>>I don't know how to debug my own code,
Well, you had better start learning. The first thing you need to do is to tell us what's wrong with the program? What does it do that it's not supposed to do, or vice versa.
The first thing I …
All 3 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
hszforu
-3
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.