Write a program in c find the sum of s = 2 + 4 + 6 + 8 + ........... + 20
#include< #include< #include< main() { int i, s; s = 0; for (i=2; i < = 20; i=i+2) { s = s + i; } printf("\n The sum is %d \n", s); return(0); } |
---|
#include< #include< #include< main() { int i, s; s = 0; for (i=2; i < = 20; i=i+2) { s = s + i; } printf("\n The sum is %d \n", s); return(0); } |
---|
© Blogger templates Newspaper III by Ourblogtemplates.com 2008
Back to TOP
0 comments:
Post a Comment