Zone for ultimate tech and study update
Advertisement
Find the summation of odd numbers
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n,s;
clrscr();
printf("Input values::");
scanf("%d",&n);
s=0;
for (i=1;i<=n;i++)
if(i%2!=0)
s=s+i;
printf("Result=%d",s);
getch();
}
No comments:
Post a Comment
Please comment bellow. Share your knowledge
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please comment bellow. Share your knowledge