TELL ME HOW TO WRITE A PROGRAM IN C++ THAT IF THE USER GIVES ANY NO. THAN THE PROGRAM GIVES THE ANSWER THAT THIS NO.IS DIVISIBLE BY THE FOLLOWING NO.?FOR EXAMPLE-IF USER GIVES -10 THAN PROGRAM GIVES THE ANSWER 1,2,5.
ANSWERS: 1
Sort by: Highest Rated
-
// // The number for testing is in the variable n // int i; for (i=1 ; i<=n ; i++) { // The mod operation returns the remainder of the division of two numbers. // If the remainder is zero, then it is divisible by that number. if (n%i == 0) { printf("Divisible by: %d", i); } }
-
No comments
RELATED QUESTIONS
RELATED TOPICS
ABOUT ANSWERBAG
Answerbag wants to provide a service to people looking for answers and a good conversation. Ask away and we will do our best to answer or find someone who can.We try to vet our answers to get you the most acurate answers.
Copyright 2023, Wired Ivy, LLC