Ask Question

Create a loop that will output all the numbers less than 200 that are evenly divisible (meaning remainder is zero) by both 5 and 7. 35, 70, 105, 140, 175

+1
Answers (1)
  1. 27 February, 00:03
    0
    public class num7 {

    public static void main (String[] args) {

    int n = 1;

    while (n<200) {

    if (n%5==0 && n%7==0) {

    System. out. print (n);

    System. out. print (",");

    }

    n++;

    }

    }

    }

    Explanation:

    In Java programming Language Create and initialize an int variable (n=1) Create a while loop with the condition while (n<200) Within the while loop use the modulo operator % to check for divisibility by 5 and 7 Print the numbers divisible by 5 and 7
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Create a loop that will output all the numbers less than 200 that are evenly divisible (meaning remainder is zero) by both 5 and 7. 35, 70, ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers