#include int main(void) { int x; // 繰り返し読み込んで、決まった数字(0など)が来たら終わるような場合 while(1){ scanf("%d", &x); if(x==0){ break; } // 処理 } return(0); }