ahh,, that's right,, thanks a lot Matticus,, that clears things up,, ^^
Type: Posts; User: jannr
ahh,, that's right,, thanks a lot Matticus,, that clears things up,, ^^
Thanks Matticus! but why is it like that?
Hi again. what's wrong with this code?
#include <stdio.h>
#include <conio.h>
int main(void)
{
char name[20];
Thanks!!
Thanks! then I'll just have to instruct the user only to enter alphabets,, ^^
Thanks agen subhash.rao,, ^^
ahh,, It works!! Thanks! I thought that c won't recognize alphabets in counting. lol,, so here's another question, do this run on turbo c?
Hi! I would like to seek advice or insights regarding this lengthy program that I made for an assignment and was wodering if it can be shortened or if there is something wrong with it, although it...
lol,, I forgot,, haha sorry,,
while(counter<=num1)
{
sum += num2;
counter++;
}
You could try this while loop:
while(counter<=num1)
{
sum += num2;
}
awts! that's it! thanks a lot laserlight!
you can put
system("pause");
before return 0. it will pause the program.
jannr
I'm wondering if something is wrong with this code.
the supposed output should be:
Enter gallons consumed(-1 to end): -1
//skips the miles prompt and ends the loop
...some code after...
hmm, I guess you're right. I am actually studying by myself in advance here on CProgramming.com and also reading the book that was provided to us, which is "C how to program".
I'm quite far from...
Ahh,, Thanks for the info CommonTater.
However, I cannot use limits.h yet as we have not taken it up yet so I'll just stick to 0 this time but I would definitely try and use limits.h.
Great...
Thanks CommonTater, initializing all the values first will prevent having "undefined behavior"
jannr
@Fader_Berg: If the user inputs all positive numbers and you have initialized min to 0 then the value of min will always be 0 and the same with the max if all the numbers are in negative.
AH! I get it,, ok2,, so i just have to initialize both min and max with the first value! Thanks!!
yes but if I also initialize min, the smallest will always be 0 if the user do not enter a negative number.
Thanks! I've solved it!
Here it is:
[Edit]
#include <stdio.h>
#include <conio.h>
Btw, I solved the prob, I just have to initialize max and I did not initialize min as it will make min = 0 the smallest number thus cannot be changed with the users input.
Thanks all!!
Thank you very much! It was dumb of me not to notice that. Thanks a lot guys!! ^^
@caludiu: well, I can't really use loops though, I can only use if statements and nothing else,, hehe Thanks though
HI! I am a first year IT student and am facing a problem. I need to create a program that finds and prints the largest and smallest number of a series of 5 numbers inputted by the user. I already...