Answer / Explanation:
#include <iostream>
using namespace std;
int main()
{
int userNum = 0;
userNum = 20;
cout << userNum << " ";
while (userNum > 1)
{
userNum = userNum/2;
cout << userNum << " ";
}
cout << endl;
return 0;
}
However, we should note that the above codes divides properly but when it gets to 0, it will always give output as 0 instead of terminating the program.
Hence to make it terminate, we include:
while (userNum > 1)
{
cout << userNum << " ";
userNum = userNum/2;
}
The above code alternatively should be replaced with int userNum = 0; .
Also, for the sake of industry best standard and the general principle, we can say:
The general principle is:
while ( <conditional> )
{
// Use the data
// Change the data as the last operation in the loop.
}
A for loop provides natural placeholders for these.
for ( <initialize data>; <conditional>; <update data for next iteration> )
{
// Use the data
}
If you were to switch to using a for loop, which I recommend, your code would be:
for ( userNum = 20; userNum > 0; userNum /= 2 )
{
cout << userNum << " ";
2 or 3 ways.......................................
Answer:
division
Explanation:
/ in programming language is divide ÷
Answer:
Stands for "Graphical User Interface" and is pronounced "gooey." It is a user interface that includes graphical elements, such as windows, icons and buttons. The term was created in the 1970s to distinguish graphical interfaces from text-based ones, such as command line interfaces.
Explanation:
The graphical user interface is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces, typed command labels or text navigation. A GUI allows the user of a computer to communicate with the computer by moving a pointer around on a screen and clicking a button. ... A program on the computer is constantly checking for the location of the pointer on the screen, any movement of the mouse, and any buttons pressed.A GUI uses windows, icons, and menus to carry out commands, such as opening, deleting, and moving files. Although a GUI operating system is primarily navigated using a mouse, a keyboard can also be used via keyboard shortcuts or the arrow keys.
Select all answers except computers, xbox, playstation 5, and mobile!
hope this helps!