Naveed Ahmed 624 profile image 85

How to write a simple C Program for calculating a sum of integers?


In C Programming using C++ Environment, I want to calculate the sum of some continuous integers, say 1 to 10. I have studies some loop structures like "while", "do-while" and "for" etc. While I can successfully get the required output using the "while" loop structure, I am not getting the desired output using the "for" loop structure. The program code is attached as an image below. Can I get the desired output using the "for" loop or not? The output I am getting using the "for" loop is also attached.

 

sort by best latest

profile image59

Amaravathi (amaravathy) says

You can help the HubPages community highlight top quality content by ranking this answer up or down.

2 years ago
 |  Comment