Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Here's my understanding fetching the input:

Objective-C
int num = 0;
NSLog (@"Input 5 numbers");

scanf("%d", &num);


NSLog (@"\n You inputted: %d !", num);


Sample Input: 54321 Output: 54321

But the output should be:
5
4
3
2
1
Posted
Comments
Thomas Daniels 3-Dec-14 11:39am    
You actually don't input 5 numbers, but one number with 5 digits. You should split the numbers in digits and then print them. (I cannot really help you with writing the code because I don't know Objective-C, but I could share the cause anyway)

1 solution

You must loop 5 times
int num = 0;
NSLog (@"Input 5 numbers");
for( int count = 0; count < 5; count++ ) {
  scanf("%d", &num);
  NSLog (@"\n You inputted: %d !", num);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900