Friday, March 28, 2014

Program to Get Digits like 1234 and print spaced digits like 1 2 3 4

#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,reverse;
printf("\nEnter Digits : ");
scanf("%d",&a);
while
    (a!=0)
{

reverse=reverse*10;
reverse=reverse+a%10;
a=a/10;}
    {printf("%d",reverse%10);
    printf(" ");
    reverse=reverse/10;
    printf("%d",reverse%10);
    printf(" ");
    reverse=reverse/10;
    printf("%d",reverse%10);
    printf(" ");
    reverse=reverse/10;
    printf("%d",reverse%10);
    printf(" ");
    reverse=reverse/10;}


line();
return 0;

}

No comments:

Post a Comment