View Code of Problem 77

#include<stdio.h>
#include <string.h>
#include <math.h>
int main(){
	int n;
	int a[10];
	int i=0;
	int j;
	int mask=1000;
	scanf("%d",&n);
	do{
		int d=n/mask;
		a[i++]=d;
		n %=mask;
		mask /=10;
	}while(mask>0);
	for(j=0;j<4;j++){
		printf("%d ",a[j]);
	}
	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 77