|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
hi...i know this is really basic
i want to display a loop of 10s 10 20 30 40 etc... how do i go about it. i always thought i could do it using for loops. for (x=0;x<=100;x+10) but obviously not. can this be done using for loops?or do i have to use something else. when i replace x+10 with x++ it works...but i want to count up in 10s |
|
|
|
|
|
#2 | ||
|
Its the Dark Side!
|
rather easy, lets assume that the loop will print as you mentioned, 100 times:
Code:
int i=0;
int number=10;
for(i=0;i<=100;i++){
printf("number is %d: ",number);
number=number+10;
}
__________________
CN ![]()
|
||
|
|
|
|
|
#3 |
|
Member (10 bit)
|
many many thanks...im totally useless at programming
actually...im useless at electronic engineering in general |
|
|
|
|
|
#4 |
|
Dark
|
just a hint: if you ever do Java too, its almost the same as language C, so if you have the same problem, basicly its the same as the above with "println" instead
__________________
1. Intel Core2Duo 3Ghz|Asus P5K Deluxe Wifi|4GB DDR2 800Mhz| Seagate 500GB*2| Evga 8800GTX 768MB| Antec SonataII case w/ 550W TruePower PSU|XP Pro 2. AMD Athlon 64 3500|Asus A8N-sli deluxe|2GB DDR ram|Maxtor 250GB HDD|ASUS NVIDIA 6800 256MB|antec sonataII case w/ 450W PSU|XP home |
|
|
|
|
|
#5 |
|
Member (10 bit)
|
probably going to learn C++ and C# after this. java is a sure thing. dont see why i have to know so many languages.any good resources for just C?most websites give C++ and the syntax confuses me eventhough its all structurally similar.bleh
![]() worse thing is programming is not the weakest link in my course...its scientific priniples(where i have to calculate resistance and impedence and all that other crap) |
|
|
|
|
|
#6 |
|
Member (13 bit)
Join Date: Mar 1999
Posts: 6,791
|
Java and C++ are similar. Java and C are different, however. Try python out as well, I hear it's easy to learn. HTH
|
|
|
|
|
|
#7 | |
|
Member (10 bit)
Join Date: May 2005
Location: Republic of Kosova
Posts: 581
|
Quote:
|
|
|
|
|
|
|
#8 | |
|
Member (9 bit)
Join Date: Feb 2005
Posts: 392
|
Quote:
just what is " x+10" in C? Answer: 10 --->0+10=10; x is not incremented; x stays 0 forever, your loop becomes infinite! shouldnt it be "x+=10"? if u use x+=10, it should work. hth.
__________________
words to live by: others don't know, I know. others know, I know more. others know more, I excel. one shouldnt read this far; above, is meant as an encouragement, translated from a Chinese Proverb. "He who angers you conquers you." : Elizabeth Kenny Last edited by alfie2; 12-21-2005 at 04:48 AM. |
|
|
|
|
|
|
#9 | |
|
Member (10 bit)
|
Thank you
Quote:
OMG!!! ITS AMAZING! IT WORKS!! woohoo....much more efficient that the first respose(but thank you for that Computer Nut) ![]() now all i have to do is sit in a 4 hour exam and program useless number crunchers you can easily do with a pencil and paper |
|
|
|
|
|
|
#10 | |
|
Its the Dark Side!
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|