Q3: Write a program using a while loop that will add both all the odd and all the even
numbers from 1 to 10 inclusive i.e. 1+3+5+7+9 and 2 + 4 +6 +... . The results are then
printed out.
num=input ("enter value")
while num<10:
num=num+2
print num,
print "goodbye"
The results are there and so is the problem:
enter value:1
3 5 7 9 11 goodbye
It goes up to 11....how do I change it??
And should it be a variable or not??
Post edited at 5:28 am on Nov. 14, 2008 by tiara
-------
I'm not cheap I'm broke :):):)