0
Hello can you help me how to program in c (loop) that the given number is 1-100 but not divisible by 5 thanks
4 Answers
+ 1
1)
for (i=1;i<n;++i)
if (i%5){
....
}
2)
for (q=0;q<(n/5);q+=5){
m=n-q>4?5:n-q;
for (r=1;r<m;++r){
n=q+r;
.....
}}
+ 1
Since VcC is giving away answers, here's what I was talking about.
for ( int i = 1; i <= 100; ++i) {
if (i % 5 != 0)
printf(i);
}
0
Here's a hint. If a number IS divisible by 5, the remainder of that number divided by 5 should be zero. See if you can get it using the % operator and the ! operator.
0
can anyone give a sample program thanks