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.?

Recommended Answers

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 …

Jump to Post

All 3 Replies

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'.

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.
scanf("%d",&num);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.