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
I am Lyosha [343]
4 years ago
15

Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has

already been declared, use a for loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j
Computers and Technology
1 answer:
OLEGan [10]4 years ago
6 0

Answer:

#include<iostream>

using namespace std;

//main function

int main(){

   //initialize the variables

   int n = 5;

   int j=1;

   // for loop

   for(;j<=n;j++){

       cout<<"*";  //print the '*'

   }

}

Explanation:

Create the main function and declare the variable n with the value 5 and initialize the variable j with zero.

take a for loop for executing the statement again and again until a condition is not false.

Syntax for loop:

for(initialize; condition; increment/decrement)

{

 statement;

}  

we can initialize the variable outside as well but the semicolon always present in the loop otherwise compiler gives the error.

for example:

int i=0;

for(; i<4; i++){

  statement;

}

The condition put in the original code is j <= n and n has the value 5. so, the loop executes 5 times and inside the loop, write the print statement for print the character '*'.

You might be interested in
PLEASE HELP!! FIRST ANSWER WILL MARK AS BRAINLIEST!!!
3241004551 [841]

Use the "As an Outlook Contact" option.

0 0
3 years ago
Tom teaches in a high school. He wishes to sort a spreadsheet containing students' marks in various subjects by descending order
cricket20 [7]

Answer:

Select the data to sort

Explanation:

4 0
3 years ago
A) Construct NFA accepting a language L = a (ae)*or (iou)*. ∑ = {a, e,i, o,u} b) Convert the above NFA to an equivalent DFA by u
frutty [35]

ksoxkajsjjwjxjxiqwikwkak,hsjsjskxkososlajzhxjwjskksoa

8 0
3 years ago
Why backup system of data and software is necessary. ​
zavuch27 [327]

Answer:

The purpose of the backup is to create a copy of data that can be recovered in the event of a primary data failure. Primary data failures can be the result of hardware or software failure, data corruption, or a human-caused event, such as a malicious attack (virus or malware), or accidental deletion of data.

7 0
3 years ago
Choose all of the devices where an operating system can be found.
den301095 [7]

Answer:

mainframe and desktop computers

smartphones

embedded devices controlling robots

5 0
4 years ago
Other questions:
  • The ? Tool removes blemishes and imperfections by sampling pixels around the spot and then paints withh matching texture, transp
    10·1 answer
  • If you want to refine your google search results by date, which option should you use?
    10·1 answer
  • A(n) ____ is a location on your computer screen where you type text entries to communicate with the computer’s operating system.
    9·2 answers
  • Refer to the following statement: “We have implemented several IT solutions:
    14·1 answer
  • The NFiPA 704 system uses a numerical value between _____ and _____ to indicate the level of hazard for that particular chemical
    6·2 answers
  • What techniques are required to accept
    12·1 answer
  • What three actions happen when you cloak a folder or file?
    6·1 answer
  • Using the arrow key you can adjust the position of a selection in increments of
    7·1 answer
  • What is the maximum number of guesses it will take to find a number <br> between 1 and 64?
    11·1 answer
  • Derek, a project manager. is involved in an activity that occurs during the system-level requirements analysis. In which activit
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!