Tuesday, July 28, 2009

Can anyone help me in C programming?

I want to make a program using C programming that will output a multiplication table of any number that the user inputs. Hope somebody can help.

Can anyone help me in C programming?
#include%26lt;stdio.h%26gt;


void main()


{


int n,l,i,p;


printf("\nEnter the no. for which u need the multiplication table:");


scanf("%d",%26amp;n);


printf("Enter the last multiple :");


scanf("%d",%26amp;l);


for(i=1;i%26lt;=l;i++)


{


p=i*n;


printf("\n\t%d X %d = %d",i,n,p);


}


}
Reply:#include %26lt;stdio.h%26gt;





int main()


{


int num=0,i,j;


printf("Input number");


scanf("%d",%26amp;num);


printf(" ");


for(i=0;i%26lt;=num;i++)


printf("%4d",i);


printf("\n");


for(i=0;i%26lt;=num;i++)


{


printf("%4d",i);


for(j=0;j%26lt;=num;j++)


printf("%4d",i*j)


printf("\n");


}


return 1;


}


No comments:

Post a Comment