c语言 任意两个数相加,等于十就保留否则继续,要怎样编写啊?
c语言 任意两个数相加,等于十就保留否则继续,要怎样编写啊?程序代码:
#include <stdio.h> #include <stdlib.h> int main(int argc,char *argv[]) { int sum=0,tmp1,tmp2; if (argc != 3) { printf ("input error!`"); exit(1); } tmp1 = atoi(argv[1]); tmp2= atoi(argv[2]); while (sum=tmp1+ tmp2) != 10); { printf ("please input number"); scanf("%d%d",tmp1,tmp2); printf ("\n"); } printf("%3d +%3d = 10\n",tmp1,tmp2); reutnr 0; }