orignal number

This is a discussion on orignal number within the C Programming forums, part of the General Programming Boards category; Hi every one same old problem but statment changed. here is the code i used Code: #include<stdio.h> #include<stdio.h> #include<conio.h> main() ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    10

    Angry orignal number

    Hi every one
    same old problem but statment changed.
    here is the code i used
    Code:
    #include<stdio.h>																																																																																		 #include<stdio.h>
    #include<conio.h>
    main()
    {
    int a;
    int count=0;
    int number,rem,div;
    int x=0;
    clrscr();
    	scanf("%d",&a);
    	while(a>1)
    	{
    	  rem = a % 10;
    	  div = a / 10;
    	  a = div;
    	printf("%d ",rem);
    	}
    	printf("%d ",div);
    
     }
    input:1214
    output:4 1 2 1
    required output: 1 2 1 4.
    anyone can help me out??.....

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    use array
    first fill it with digest of the number
    when print it in the reverse order
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help getting program print out the digit in words
    By cosmiccomputing in forum C Programming
    Replies: 26
    Last Post: 04-24-2008, 08:28 AM
  2. Need help with this compiler error
    By Evangeline in forum C Programming
    Replies: 7
    Last Post: 04-05-2008, 09:27 AM
  3. Prime number program problem
    By Guti14 in forum C Programming
    Replies: 11
    Last Post: 08-06-2004, 04:25 AM
  4. parsing a number
    By juancardenas in forum C Programming
    Replies: 1
    Last Post: 02-19-2003, 12:10 PM
  5. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 04:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21