Write a program that display the sum of all the positive odd numbers
from 1 to 100 but skipping those are divisible by 3 and 5
Answers
Answered by
0
Answer:
1 2 4 7 8 11 13 14 16 17 19 22 23 26 28 29 31 32 34 37 38 41 43 44
46 47 49 52 53 56 58 59 61 62 64 67 68 71 73 74 76 77 79 82 83 86 88 89
91 92 94 97 98
Answered by
0
Given:
We are asked to write a program that display the sum of all the positive odd numbers from 1 to 100 skipping those numbers divisible by 3 and 5
PROGRAM:
#include<stdio.h>
void main( )
{
int 100,count =1 ,sum =0;
while(count<=100)
{
if(count%2 !=0 && count%3 !=0 && count%5b !=0)
{
sum = sum+count;
}
count++;
}
printf("The sum of odd numbers from 1 to 100 skipping those are divisible by 3 and 5 is %d\n",sum);
}
Similar questions