- 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.

19th Feb 2020, 2:10 PM
Harshal Modak
Harshal Modak - avatar
6 Réponses
+ 6
Seb TheS 😂👍
19th Feb 2020, 2:19 PM
Avinesh
Avinesh - avatar
+ 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/
19th Feb 2020, 2:18 PM
Seb TheS
Seb TheS - avatar
+ 4
Amorhop lol why even go throught multiples of 2 and 3, just check if divisible by 6..
19th Feb 2020, 2:41 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Amorhop also multiples of 4 are divisible by 2 and 3.
19th Feb 2020, 2:36 PM
Avinesh
Avinesh - avatar
+ 1
Amorhop just check x%6==0
19th Feb 2020, 3:10 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 1
Well 6 is not divisible by 4, and 6 obviously is a multiple of itself.
19th Feb 2020, 3:14 PM
Aymane Boukrouh
Aymane Boukrouh - avatar