题目要求
根据打印结果,编写程序
思路分析
输入一个数num, num = n+ num-n ,n肯定是<=sum的值
撸写代码
#include<stdio.h>
int main()
{
int n,sum;
printf("请输入:");
scanf("%d",&sum);
for(n=1;n<=sum;n++)
{
printf("\n%d + %d = %d",n,sum-n,sum);
}
return 0;
}
根据打印结果,编写程序
输入一个数num, num = n+ num-n ,n肯定是<=sum的值
#include<stdio.h>
int main()
{
int n,sum;
printf("请输入:");
scanf("%d",&sum);
for(n=1;n<=sum;n++)
{
printf("\n%d + %d = %d",n,sum-n,sum);
}
return 0;
}