Answer:
import java.io.*;
import java.util.Scanner;
class divide {
public static void main (String[] args) {
Scanner num=new Scanner(System.in);//scanner object.
int userNum=num.nextInt();
while(userNum>1)//while loop.
{
userNum/=2;//dividing the userNum.
System.out.print(userNum+" ");//printing the userNum.
}
}
}
Input:-
40
Output:-
20 10 5 2 1
Input:-
2
Output:-
1
Input:-
0
Output:-
No Output
Input:-
-1
Output:-
No Output.
Explanation:
In the program While loop is used.In the while loop it divides the userNum by 2 in each iteration and prints the value of userNum.The inputs and corresponding outputs are written in the answer.
// Making a function that will take a integer as argument and return print the code
void Print(int statuscode){
// starting the switch statement on the interger sent
switch(statuscode)
case 200: // for case 200
cout << "Ok,Fullfilled"<< endl;
case 403: // for case 403
cout << "Forbidden" << endl;
case 404: // for case 404
cout << "Not Found" <<endl;
case 500: // for case 500
cout << "Server Error "<< endl;
default: // default case
cout << " Wrong code"<<endl;
}
The same thing as if you do it once
Answer:
<h2>C- rippled</h2><h2>O- utstanding</h2><h2>M- agical</h2><h2>P- eace</h2><h2>U- npredictable</h2><h2>T- riumph</h2><h2>E - xcellent</h2><h2>R- obust</h2>
Explanation:
<h3><u>Acronym</u>- a word that composes of long words that start with its initial letter.</h3><h3>Example: OTG (on the go)</h3>