Write a program in c to find the sum s = 1*6 + 2*9 + 3*12 + 10*33
#include< #include< #include< main() { int i, j, s; s = 0; for (i=1, j=6; i < = 10, j < = 33; i=i+1, j=j+3) { s = s + i * j; } printf("\n The sum is %d \n", s); return(0); } |
---|
#include< #include< #include< main() { int i, j, s; s = 0; for (i=1, j=6; i < = 10, j < = 33; i=i+1, j=j+3) { s = s + i * j; } 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