Hi,

I would like to print the table of a number entered by the user like

2 *1=2
2*2=4
2*3=6

The code is

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

main()

{

int i,num;

printf("Enter any number");
scanf("%d",&num);

for(i=1;i<=num;i++)

printf("%d*%d=%d",num,i,num*i);

getch();

}

But this code is generating errors.

1> 28 posts and still no code tag

2> Try to practice int main(){} not just main() or void main()

3> Post the exact error that u are getting.
The code seems to be ok I think.

The code is perfect and no errors execpt few things that shuold be avoided.
may be you want to print from

5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
:
:
5 * 10 = 50

here is your code with slight modifications and proper posting:
follow this next time

#include<stdio.h>

int main()
{
        int i, num;
        printf( " Enter any number " );
        scanf( "%d", &num );
        for( i=1 ;i <=10; i++ )
            printf( "  \t %d * %d = %d \n ", num, i, num*i ) ;
        return 0;
}

i want to make a multiplication table of any number the user input and upto the range the user input

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.