Hi, I just started learning C and I'm not sure why the program isn't working
Code:#include <stdio.h> int main(void) { printf("Enter two numbers>"); scanf("%d%d, &m, &n)"); m = m + 5; n = 3 * n; printf("m = %d \n n = %d \n", m, n); return(0); }
Hi, I just started learning C and I'm not sure why the program isn't working
Code:#include <stdio.h> int main(void) { printf("Enter two numbers>"); scanf("%d%d, &m, &n)"); m = m + 5; n = 3 * n; printf("m = %d \n n = %d \n", m, n); return(0); }
Where have you declared your variables m and n? Your compiler should be telling you why the program won't compile. In future posting these messages exactly as they appear in your development system will help us help you.
Jim
I didn't realize I left it out, but even when I add it in, it doesn't seem to work. I'm not sure what I'm doing wrong. Here's my code with declared variables
thanksCode:#include <stdio.h> int main(void) { int m, n; printf("Enter two numbers>"); scanf("%d%d, &m, &n)"); m = m + 5; n = 3 * n; printf("m = %d \n n = %d \n", m, n); return(0); }
Look closely at your scanf() call. Are the parentheses and quotation marks in the correct locations?
Jim
thanks i finally got it!