Friday, 19 August 2016

Problem Statement:
Given a 4 digit positive number n print the digits of that number.

Input:
Input contains a single psitive integer n.

Output:
Print all the four digits of the number n separated by space.

Sample test cases:

Input:
3354

Output:
3 3 5 4



Solution:


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    printf("%d ",n/1000);
    printf("%d ",(n/100)%10);
    printf("%d ",(n/10)%10);
    printf("%d ",n%10);
}

No comments:

Post a Comment