#include<stdio.h> main() { int n,j=0,k=0,a[20]; scanf("%ld",&n); for(int i=1;n/i!=0;i=i*10) { a[j++]=((n/i)%10); k++; } printf("%d",a[k-1]); for(i=k-2;i>=0;i--) { printf(" %d",a[i]); } } /* Main.c:2:1: warning: return type defaults to 'int' main() ^ Main.c: In function 'main': Main.c:5:2: warning: format '%ld' expects argument of type 'long int *', but argument 2 has type 'int *' [-Wformat=] scanf("%ld",&n); ^ Main.c:12:6: error: 'i' undeclared (first use in this function) for(i=k-2;i>=0;i--) ^ Main.c:12:6: note: each undeclared identifier is reported only once for each function it appears in */ |
Double click to view unformatted code.