+ 1

Hi, How can I print range of number (like [-x,x]) in C? Can some body help me?

For example x=2 print : -2 , -1 , 0 , 1 ,2 Or x = 1 print : -1 , 0 ,1

5th Apr 2019, 10:34 AM
sahel md
sahel md - avatar
4 Antworten
+ 1
You can use a for loop from -x to x
5th Apr 2019, 10:47 AM
Anna
Anna - avatar
+ 1
Well if you start counting from -2 and increment by one, you'll count -2, -1, 0, 1, 2
5th Apr 2019, 11:06 AM
Anna
Anna - avatar
+ 1
what exactly do u want to do ?? i didnt get it
22nd Apr 2019, 9:15 PM
Hossein Dehghanipour
Hossein Dehghanipour - avatar
0
Should I start counting from negative to positive? Or Separate negative and positive numbers? How can I count from negative to positive?
5th Apr 2019, 10:59 AM
sahel md
sahel md - avatar