#include <stdio.h> int main(){ int a,b,n; int result; int arr[1000]={0}; int count=0; int v1,v2; int index=0; if (scanf("%d %d %d",&a,&b,&n)!=EOF){ if (n==1){arr[0] = a;} if (n==2){arr[0] = a;arr[1] = b;} if (n>2){ while (count<n){ if (count==0){arr[count] = a;count++;} if (count==1){arr[count] = b;count++;} if (count<n){ result = a*b; if (result>9){ v1 = result/10; v2 = result%10; arr[count] = v1; arr[count+1] = v2; count+=2; } else{ arr[count]=result; count+=1; } index++; a = arr[index]; b = arr[index+1]; } } } } // 打印数据 for (int i=0;i<n;i++){ printf("%d",arr[i]); if (i!=n-1){printf(" ");} } return 0; }
c语言编程练习题:7-197 乘法口诀数列
作者:yunjinqi
类别:编程
日期:2023-06-04 19:08:19
阅读:530 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/321
最新文章
系统当前共有 404 篇文章