I need help in reading numbers using scanf functions.
A range of numbers have to be scanned.No array should be used.No limiting condition for reading is given.What shall i do.?

4 Years
Discussion Span
Last Post by naveen1993

Hi [mcsreerag],

What shall I do?

The question is What have you done? Show us some honest effort on your part and the areas you having problems with, then am sure someone will surely come up with a sound solution.
Meanwhile, if you are on nix system you can do like so: man scanf to see it's usage. You can start from there.


Some times the very beginning steps of computer programming seem 'very hard' ... but like learning any new complex thing ... once you 'see' how it works ... and 'how to make it work' ... you are well on your way :)

The tricky part (at first with using scanf for input), is to remember that it needs the ADDRESS, passed in, of the variable(s) passed into the scanf function, in order that THAT VERY SAME variable gets updated in the 'calling scope'.

There are many many examples on the web ... (Google 'C scanf' and see) ...

But you may like to take a look at the examples here:

6 fast steps in C

Once you understand well, a few basics, programming can become very enjoyable ... if you like 'problem solving'.

Edited by David W: added comments


With reference to ur query,
U may proceed like this also if u like it..
int num,n;
printf("Enter the numbers");
for(i=0;i<=n;i++)//U can enter n numbers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.