![Mordred7823](/avatars/20901.jpg)
Mordred7823
21.10.2020 •
Computers and Technology
Write a method printOdds1To11 that prints the odd numbers between 1 and 11 inclusive, one on each line. The program should calculate the odd numbers in a loop. The program text should not include the digits 3, 5, 7, or 9, but it will print these numbers out using System.out.println along with 1 and 11, in numerical order. It should only contain a single println statement. The program should take no arguments and return no value, just print things out.
Solved
Show answers
More tips
- G Goods and services Top 5 Best Laundry Detergents for Impeccable Cleanliness of Your Clothes...
- S Society and Politics Как правильно поддерживать температуру в квартире для здоровья...
- L Leisure and Entertainment How to Make a Crab Trap in Just a Few Minutes...
- H Health and Medicine How Much Does Abortion Cost? Expert Answers and Insights...
- S Sport How to Build Arm Muscles? Effective Exercises and Tips...
- H Health and Medicine When can it be said that a person has a normal pulse?...
- A Art and Culture When Will Eurovision 2011 Take Place?...
- S Style and Beauty How to Choose the Perfect Hair Straightener?...
- F Family and Home Why Having Pets at Home is Good for Your Health...
- H Health and Medicine How to perform artificial respiration?...
Answers on questions: Computers and Technology
- S Social Studies Before mcculloch v. maryland went to court, the state of maryland...
- M Mathematics Help please thanks....
- M Mathematics I’m only 10 so don’t judge but me is this less or higher or lower...
- H Health These victims have red, hot skin, and tiny pupils. heat exhaustion frostbite heat stroke...
- P Physics A projectile is fired at a velocity of 50 m/s straight into the air. What is the velocity of the projectile when the objects displacement is 16 meters and headed downward?...
Ответ:
The method goes thus
static void printOdds1To11(){
for(int i = 1; i<=11;i++){
System.out.println(i);
}
}
Explanation:
This line defines the method
static void printOdds1To11(){
This line iterates from 1 to 11 with an increment of 2
for(int i = 1; i<=11;i+=2){
This line prints the odd number in this range
System.out.println(i);
}
}
Ответ:
Dhdhdhdhdhdhdhehehe