find the sum of all three digit numbers which are divisible by 3 but not divisible by 5
Answers
Answered by
7
333+333+333=999÷3=333&999÷5=199.9
so digit's are 333,333,333
Answered by
0
Answer:
# include < stdio. h >
int main ( )
{
int i ,
for ( i = 100 ; i<= 999 ; i++ )
{ if ( i % 3 == 0 && i % 5 != 0 ) // main logic
printf ( " %d " , i ) ;
sum = sum + i ;
}
printf ( " find the sum of all three digit numbers which are divisible by 3 but not divisible by 5 is % d " , sum ) ;
return 0 ;
}
note : if both condition is satisfied then the program will print the number and lastly print the sum of all three digit numbers which are divisible by 3 but not divisible by 5
Similar questions