+ 1

I need help about the choice of the statement

I wanna finish a code about the division by (2, 3, 4, 5, 7, 9....) and it can be divided by one or more numbers so which statement you propose to facilitate that , it will look like a long program but I wanna it as shot as I can , till what I learned , I found that switch can do it shorter, any proposition ? (sorry for my self English😝😝)

13th Jan 2018, 7:02 PM
Rayen Jbahi
Rayen Jbahi - avatar
6 RĂ©ponses
+ 2
the user have to put a number , and the program shows him the ability of dividing this number by 2,3,4,5,7,8,9 because we are asked in our study (in mathematics ) to look if for example 1230 is able to be divided by one or more of those numbers for that example input : 1230 output : your number 1230 is divided by 2, 3, 5 for another example input : 17 output : your number 17 can not be divided by any of these (2,3,4,5,7,8,9) than I can add the ability to divide by 11 and more ,but now I am starting with only those
14th Jan 2018, 9:17 PM
Rayen Jbahi
Rayen Jbahi - avatar
+ 2
Thanks now I understand. Have a look at the foreach statement. Put the numbers that are use to divide by in an array or a list
14th Jan 2018, 9:23 PM
sneeze
sneeze - avatar
+ 2
waww , it's optimized , really thank you I was thinking of something really complexed , and you give me something 👌👌👌
14th Jan 2018, 11:03 PM
Rayen Jbahi
Rayen Jbahi - avatar
+ 1
So the input is a number ? This number is divided by 2,3,4,5,7 or 9 And you have to display the result. What does the user needs to do when the number needs to be divided by more than one of the given numbers ? Sorry it is unclear to me what you want to do.
14th Jan 2018, 8:53 PM
sneeze
sneeze - avatar
+ 1
the problem is : if the number can be divided by more than a number !! I am going to use the "And" but how much I will do that , is there something easer
14th Jan 2018, 9:28 PM
Rayen Jbahi
Rayen Jbahi - avatar
+ 1
14th Jan 2018, 9:50 PM
sneeze
sneeze - avatar