2020年5月21日 星期四

正課 Week 12_07166046

練習瘋狂程設實習題







#include <stdio.h>
int main()
{
while(1){
int n;
scanf("%d", &n);  //技巧1 迴圈讀資料
if(n==0) break;

printf("%d is a multiple of 11.\n", n);
}

}




#include <stdio.h>
#include <string.h>
//int 只有10位數 太長讀不進來
//把它當作很長的英文讀入 用字串[1001]
char line[1001];
int main()
{
while(1){
scanf("%s", line);
if(strcmp(line,"0")==0) break; //技巧2 用字串 字串比對

if(1) printf("%d is a multiple of 11.\n", line);
else printf("%d is not a multiple of 11.\n", line);

}

}








沒有留言:

張貼留言