1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artyom0805 [142]
3 years ago
14

Write a while loop that prints 1 to user_num. Sample output for the given program: 1 2 3 4

Computers and Technology
2 answers:
Scorpion4ik [409]3 years ago
6 0
Given 1234
i=1
user num=4#assume positive
while (user-num>=i);
print(i)
i+=1
#include <iostream>
using namespace std;
int main()
{int userNum=0;
int i=0;
userNum=4; ##assume positive
i=1;
while (i <=userNum){
cout<<i>>" ";
i=i+1;
cout <<endl;
return0;
}
lina2011 [118]3 years ago
5 0
<h2><u>Answer:</u></h2>

So the given program: 1 2 3 4

i=1

User num=4#assume positive

While (user-num>=i);

print(i)

i+=1

#include <iostream>

using namespace std;

int main()

{int userNum=0;

int i=0;

userNum=4; ##assume positive

i=1;

while (i <=userNum){

cout<<i>>" ";

i=i+1;

cout <<endl;

return0;}



You might be interested in
Write a program that will predict the size of a population of organisms. The program should ask the user for the starting number
sineoko [7]

Answer:

// using c++ language

#include "stdafx.h";

#include <iostream>

#include<cmath>

using namespace std;

//start

int main()

{

 //Declaration of variables in the program

 double start_organisms;

 double daily_increase;

 int days;

 double updated_organisms;

 //The user enters the number of organisms as desired

 cout << "Enter the starting number of organisms: ";

 cin >> start_organisms;

 //Validating input data

 while (start_organisms < 2)

 {

     cout << "The starting number of organisms must be at least 2.\n";

     cout << "Enter the starting number of organisms: ";

     cin >> start_organisms;

 }

 //The user enters daily input, here's where we apply the 5.2% given in question

 cout << "Enter the daily population increase: ";

 cin>> daily_increase;

 //Validating the increase

 while (daily_increase < 0)

 {

     cout << "The average daily population increase must be a positive value.\n ";

     cout << "Enter the daily population increase: ";

     cin >> daily_increase;

 }

 //The user enters number of days

 cout << "Enter the number of days: ";

 cin >> days;

 //Validating the number of days

 while (days<1)

 {

     cout << "The number of days must be at least 1.\n";

     cout << "Enter the number of days: ";

     cin >> days;

 }

 

 //Final calculation and display of results based on formulas

 for (int i = 0; i < days; i++)

 {

     updated_organisms = start_organisms + (daily_increase*start_organisms);

     cout << "On day " << i + 1 << " the population size was " << round(updated_organisms)<<"."<<"\n";

     

     start_organisms = updated_organisms;

 }

 system("pause");

  return 0;

//end

}

Explanation:

6 0
3 years ago
How to get to meters to kilometer
Lena [83]

Answer:

The length in kilometers is equal to the meters divided by 1,000.

Explanation:

The length in kilometers is equal to the meters divided by 1,000.

7 0
2 years ago
Read 2 more answers
What is the definition of hardware
wel
<span>the machines, wiring, and other physical components of a computer or other electronic system.</span>
3 0
3 years ago
Read 2 more answers
Which function can be used to insert the current date into a spreadsheet?
VladimirAG [237]

Answer:

im pretty sure it MM/DD/YYYY

Explanation:

3 0
3 years ago
A company has two finalists in mind to run its computer network: Bill, a college graduate in computer science with little experi
irga5000 [103]
Sam has more experience
5 0
3 years ago
Other questions:
  • What kind of voltage do solar cells generate? Solar cells produce ______ voltage which is not usable by most household appliance
    15·1 answer
  • Your organization will be handling market trades. You will be required to verify the identify of each customer who is executing
    8·1 answer
  • The next generation ip version and successor to ipv4 is called what? ipv5 ipv6 iana ssl
    13·1 answer
  • ________ are the most popular method used by visitors to find web sites.
    6·1 answer
  • Using the __________ option, you can change the state of a model back to where a particular feature or features weren`t yet crea
    7·1 answer
  • Which director has shot a movie in HD? George Lucas, Michael Mann, Michael Moore, none of the above, all of the above
    14·1 answer
  • What type of control structure is the default method of the computer reading code?
    9·1 answer
  • What is abbreviation of the computer​
    15·2 answers
  • Anybody wanna be friends?
    10·2 answers
  • Explain any two features of a computer​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!