Here the questions:
As you may have figured out by now, there are two kinds of flow-control operators: a branching operator (if, switch) and a looping operator (for, while). With these operators, it is possible to do a lot of work without doing a lot of coding.
1) Write code to find all of the prime numbers between 2 and 100. A prime number is a number that is evenly divisible only by itself and 1. The number 10 is not a prime because it is evenly divisible by 2 and 5.
2) Write code to find average of all of the numbers in the scores array. Also, using the names array, print out the names of all of students whose score is 70 or above. Assume that student’s name has the same index score.
double score [] = {50, 100, 75, 81, 90.5, 66, 33, 99};
String names [] = {“Daud”, “Mary”, “Johan”, “Nani”, “Susan”, “Eliza”, “Tomy”, “Nick”};

New Topic/Question
Reply




MultiQuote




|