Back To C++ Loops Index
//program to input two numbers and find sum of numbers between them using while statement #include
#include
void main() { int i,a,b,sum=0; clrscr(); cout<<"enter value for a"; cin>>a; cout<<"enter value for b"; cin>>b; i=a; while(i<=b) { sum=sum+i; i++; } cout<<"sum of numbers between a and b is "<