• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

I want C program that receives numbers until the user input (-1), then print reverse all of numbers

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Bartender
Posts: 669
15
TypeScript Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a question or what
 
Marshal
Posts: 80111
414
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think you have misunderstood the quesstion. You are supposed to enter numbers and stop when −1 is entered. You want a loop for the input with ... while (input != -1) ... in. You need a separate function for reversing the digits in the number.
Warning: 567890 will reverse to 98765, and if you reverse that again you will get 56789, not the original number.
 
Alireza Saidi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Hobbs wrote:Do you have a question or what


Hell0! I need help to solve it please.
 
Alireza Saidi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello dear friend! How can I solve that? Can you help me please?
 
Campbell Ritchie
Marshal
Posts: 80111
414
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't quote the whole of a preceding post; that adds nothing new and is liable to removal without notice.
Start by writing a program that takes entry of a number and simply prints, “You entered 123456.” When that is working correctly, you can enhance it by adding more functionality.
 
Rancher
Posts: 508
15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Alireza - please can you copy/paste the actual question just so we know exactly what it is you are trying to do?
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alireza Saidi wrote:Hello dear friend! How can I solve that? Can you help me please?


People here love to help you, but they won't do it for you.  You need to tell us what exactly the problem is.  Does this compile? does it run?  does it give the wrong output?

tell us the details.  Ask questions.  engage with people who post, and you will get more help than you could ever ask for.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
first, take out the while loop from the recursive function and put it on the main function instead.
then, your prorgam function should look something like
 
Campbell Ritchie
Marshal
Posts: 80111
414
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch
 
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic