从给定数字打印乘法表到给定的nunber。 [英] Print multiplication table from a given number upto a given nunber.
本文介绍了从给定数字打印乘法表到给定的nunber。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <stdio.h>
int main()
{
int a,b,i,j,product;
printf("enter the numbers of table you want to see:");
scanf("%d %d",&a,&b);
for(i=1;i<=10;i++)
{
for(j=a;j<=b;j++)
{
product = j * i;
printf("%d x %d = %d",&j,&i,&product);
printf("\t");
}
printf("\n");
}
return 0;
}
我的尝试:
我尝试过使用嵌套for循环,就像打印表格一样。
What I have tried:
I have tried using nested for loops like we do to print tables.
推荐答案
您正在打印变量的地址:
You are printing the addresses of variables:
printf("%d x %d = %d",&j,&i,&product);
而不是变量内容:
rather that the variable content:
printf("%d x %d = %d", j, i, product);
这篇关于从给定数字打印乘法表到给定的nunber。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文