Back To C Loops Index
//program to input two numbers a and b and find sum of numbers between them using for statement #include
#include
void main() { int a,b; int i; int sum=0; clrscr(); printf("enter value for a"); scanf("%d",&a); printf("enter value for b"); scanf("%d",&b); for(i=a;i<=b;i++) { sum=sum+i; } printf("sum of numbers from a to b is %d",sum); getch(); }