Develop a C program to find total of all the integer number divisible by 3 between 1 to 100 using while loop
Code
#include <stdio.h>int main(){int i=1, sum=0;printf("Numbers between 1 and 100, divisible by 3 : \n");while(i<=100){if(i%3==0){printf("% 5d",i);sum+=i;}i++;}printf("\n\nThe sum : %d \n",sum);return 0;}
Output
0 Comments
Post a Comment