void main()
{
int number,i,result;
printf("Enter the number whose table is required\n");
scanf("%d",%26amp;number);
for(i=1;i%26lt;=10;i++)
{
result=number*i;
printf("\n%2dX%2d=%2d",number,i,result);
}
getch();
}
How to make a multiplication table using looping statement of c programming?
If you just want a list of numbers you just need a loop similar this
int factor;
int max_itterations;
int itterations;
factor=5;
max_itterations=12;
for (itterations = 1; itterations %26lt;= max_itterations; itterations++)
{
printf("%d ",(itterations * factor));
}
You can produce a table by introducing another loop that will display the numbers however you want them formatted.
Reply:here is the code for u
#include %26lt;stdio.h%26gt;
int main()
{
int table_size = 12;
int row = 0;
int col = 0;
for(col=0 ; col%26lt;=table_size ; col++){
printf(" %4d", col);
}
printf("\n");
for(col=0 ; col%26lt;=table_size ; col++){
printf("_____");
}
for(row = 0 ; row%26lt;=table_size ; row++){
printf("\n");
for(col = 0 ; col%26lt;=table_size ; col++) {
if(row == 0) {
if(col == 0){
printf(" ");
}else{
printf("|%4d", col);
}
}else{
if(col == 0){
printf("%4d", row);
}else{
printf("|%4d", row*col);
}
}
}
}
printf("\n");
}
try this also man
#include%26lt;stdio.h%26gt;
int main(void)
{
int i=0;
int j=0;
int result;
int d=0;
int w=1;
printf("which number you choose");
scanf("%d",%26amp;d);
result=d*j;
for(j=1;j%26lt;=10;j++)
printf("%d*%d=%d\n", d,j,d*j);
printf("\n");
return 0;
}
but this is final next time try it by yours ok
Reply:#include%26lt;stdio.h%26gt;
main()
{
int x,y;
for (x=1;x%26lt;=10;x++)
{
for (y=1;y%26lt;=10;y++)
{
printf("%dX%d=%d\n",x,y,x*y);
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment