C Programming to to find the sum of all numbers from 1 to 111 divisible by 3 but not by 2
/*to find the sum of all numbers from 1 to 111 divisible by 3 but not by 2*/ #include<stdio.h> #include<stdlib.h> int main( ) { int i,sum=0; for (i=1; i<=111; i++) { if (i%3==0&&i%2!=0) sum+=i; } printf ("sum=%d",sum); system ("pause"); return 0; }
No comments:
Post a Comment