Click here to Skip to main content
15,890,973 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
#include <stdio.h>
int square(int);
main() {
    int a;
    printf("Enter 1 integer from l—5:");
    scanf("%d", &a};
    square (a);
}
int square (int b);
{
    int I;
    for (I=1; I<=12; I++)
        printf("%d X %d = %d", I, b, I*b);
}



Aboce is the C coding about receive integer value 1 to 5 and print the multiplication table. the coding got syntax error and i can figure it out
Posted
Comments
Wendelius 3-Apr-11 10:17am    
What is the error message you got?
Jayfam 3-Apr-11 10:17am    
prog2.c:9:1: error: expected identifier or '(' before '}' token
prog2.c:12:1: error: expected identifier or '(' before '{' token

C#
#include <stdio.h>
int square(int);
main() {
    int a;
    printf("Enter 1 integer from l—5:");
    scanf("%d", &a};
    square (a);
}
int square (int b);<----this semicolon dont fit, put away it
{
    int I;
    for (I=1; I<=12; I++)
        printf("%d X %d = %d", I, b, I*b);
}
 
Share this answer
 
Comments
Jayfam 3-Apr-11 10:23am    
prog2.c:8:2: warning: parameter names (without types) in function declaration
prog2.c:9:1: error: expected identifier or '(' before '}' token
Also have a look at this line:
scanf("%d", &a};
Should be
scanf("%d", &a);
 
Share this answer
 
Comments
Jayfam 3-Apr-11 10:34am    
thx bro...not error already
Wendelius 3-Apr-11 10:41am    
You're welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900