fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int i=0,data[30],v;
  6. while(1){//無限ループ
  7. scanf("%d",&v); // vにデータを入力
  8. data[i]=v;
  9. if(v<0 || i==29) break;
  10. i++;
  11. }
  12. for(i=i-1;i>=0;i--) printf("%d ",data[i]); //入力された逆順に表示
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5316KB
stdin
2 4 6 8 10 -1
stdout
10 8 6 4 2