My question is: if I need to ask from the user to input 30 numbers what is the easy way to write it in C as a loop?
My question is: if I need to ask from the user to input 30 numbers what is the easy way to write it in C as a loop?
You should probably do it with a for loop since for loops are usually used when you know how many iterations will be done.
Using for loop would be easier for you. You can do it with while or do_while also all the loops will take same time. Or you can use recursion also.
You can write foor loop as :-
Code:int i; for(i=0; i<30; i++) { // your code goes here. }
all for helping (:
For some reason I cant think about a solution
suggestion will be accepted (:
Write a program receiving 30 three-digit integers. The program to calculate the sum of digits of unity, of the dozens and hundreds of all 30 numbers recorded on the plan at the end print the three amounts together with a suitable
This sounds suspiciously like a homework assignment, especially because it's devoid of typos and other errors in your post.
Also, don't use scanf() like the guy above suggested, it teaches terrible coding habits unlike fgets() or fread().
The C Board is not a homework machine.
Announcements - General Programming Boards
Try writing the code yourself, and we'll tell you what's wrong with it.
Originally Posted by The Jargon File
I understand you completely, believe me if I would not try before I probably Probably would not have assisted you , I've been a whole day trying to find a solution for the exercise and everything went wrong , just degrading things (: hah I tried to check all the study material given to us, classes are recorded and nothing! Anyone who wants to help, no one has to ... (:
BTW sorry for the bad English
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Sitting here waiting for the OP's code to show up...
Even if it's just an empty main(), just give us something!
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"