Friday, March 28, 2014

Get five-digit value from user and print spaces between these digits e.g. 23456 : 2 3 4 5 6

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();

    int a,b,c,d,e, number;

    printf("\nEnter a five-digit number: ");
    scanf("%d", &number);
    a= number % 10;
    b=( number /10 ) % 10;
    c=(( number / 10) / 10)%10;
    d=(((number/10)/10)/10)%10;
    e=((((number/10)/10)/10)/10)%10;
    printf("%d %d %d %d %d",e,d,c,b,a);


return 0;
}

No comments:

Post a Comment