- 1
A program to compute and display the sum of all integers numbers that are divisible by 6 but not by 4 and lie between 0-100.
6 Antworten
+ 6
Seb TheS 😂👍
+ 5
Everything you need:
Modulo to check divisibility:
https://www.sololearn.com/learn/CPlusPlus/1609/
For loop to count from 0 to 100:
https://www.sololearn.com/learn/CPlusPlus/1616/
Comparison operators and if statement to make conditional statements:
https://www.sololearn.com/learn/CPlusPlus/1612/
Logical operators to extend conditions:
https://www.sololearn.com/learn/CPlusPlus/1619/
+ 4
Amorhop lol why even go throught multiples of 2 and 3, just check if divisible by 6..
+ 1
Amorhop also multiples of 4 are divisible by 2 and 3.
+ 1
Amorhop just check x%6==0
+ 1
Well 6 is not divisible by 4, and 6 obviously is a multiple of itself.