Skip to main content
C language program for sum of odd numbers between two odd numbers given by user
#include<stdio.h>
main ()
{
int n,k,i,sum=0;
printf("Enter two odd numbers");
scanf("%d %d",&n,&k);
for(i=n;i<=k;i+=2)
{
sum=sum+i;
}
printf("Sum of no from %d to %d is %d",n,k,sum);
}
Comments
Post a Comment