Hi,
Just started programming about 2 weeks ago, I have a basic understanding of it, just wanted to know if you could help me spot the problem with this program, it compiles, it just doesnt do what I want it to do.
Code:#include<stdio.h> void main() { int choice = 0; int num1 = 0; int num2 = 0; int sum = 0; int num3 = 0; int num4 = 0; int answer = 0; printf("Please Choose a option\n"); printf("For Addition mode please press 1\n"); printf("For Muliplication mode please press 2\n"); scanf("Choose = %i", choice); if(choice == 1) { printf("Please enter a number"); scanf("Number1 = %i", num1); printf("Please enter a second number"); scanf("Number2 = %i", num2); sum = num1 + num2; printf("The sum of Number1 and Number2 is %d", sum); } if(choice == 2) { printf("Please enter a number"); scanf("Number1 = %i", num3); printf("Please enter a number"); scanf("Number2 = %i", num4); answer = num3 * num4; printf("The answer of Number1 times Number2 is %d", answer); } printf("Thank you"); }



LinkBack URL
About LinkBacks





