answersLogoWhite

0


Best Answer

...

int i;

for( i = 0; i < 7; ++i ) {

printf("*");

}

printf("\n");

...

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a for loop in C to print the 7 stars row?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Do loop example?

A nested loop is simply a loop within a loop. An example of such a loop is where you wish to traverse a two-dimensional array. The simplest way to traverse such a structure is to use a loop to traverse each row and a nested loop to traverse the elements within each row. int a[4][5]; // a 4x5 array of integers (4 rows, 5 columns). // ... for (row=0; row&lt;4; ++row) // traverse rows { for (col=0; col&lt;5; ++col) // traverse columns { std::cout &lt;&lt; a[row][column] &lt;&lt; ", "; // print value at current row and column } std::cout &lt;&lt; endl; // keep each row on a separate line }


How do you program pyramid of letters using dev c plus programming?

#includeint main(){static int ROWS = 6;char ch;printf("Please enter an UPPERCASE letter:");scanf("%c",&ch);for( int row = 0; row < ROWS; ++row ){// Print padding.for( int column = 1; column < ROWS - row; ++column)printf(" ");// Print letters left of centre.for( int letter = row; letter >= 1; --letter)printf("%c", ch);// Print centre letter.printf("%c", ch);// print letters right of centre.for( int letter = row; letter >= 1; --letter)printf("%c", ch);printf("\n");}return( 0 );}


What mechanism would you implement in the process scheduler to automate the termination of a job that is in an infinite loop?

put a counter in. set it to zero before the loop. add 1 to it inside the loop pick a realistic number for how many times it could possibly go through legitamately and have it exit the loop if the counter goes above that. or if you do not have duplicate data each time through the loop save the data compare it the next time through and if it is the same 2 or 3 times in a row abort the loop.


How do you initialize each element of a two-dimensional array alpha to 5?

Two-dimensional arrays are typically iterated through using nested for loops. If you had a 2-D array alpha with ints ROWS and COLS representing the number of rows and columns respectively, and ints row and col as iterators, the loop would look like this: for (row = 0; row &lt; ROWS; row++){ for (col = 0; col &lt; COLS; col++{ alpha[row][col] = 5; } }


How do you print 1 121 1331 14641 in c?

#include#includevoid main(){clrscr();for (int i=1;i

Related questions

Do loop example?

A nested loop is simply a loop within a loop. An example of such a loop is where you wish to traverse a two-dimensional array. The simplest way to traverse such a structure is to use a loop to traverse each row and a nested loop to traverse the elements within each row. int a[4][5]; // a 4x5 array of integers (4 rows, 5 columns). // ... for (row=0; row&lt;4; ++row) // traverse rows { for (col=0; col&lt;5; ++col) // traverse columns { std::cout &lt;&lt; a[row][column] &lt;&lt; ", "; // print value at current row and column } std::cout &lt;&lt; endl; // keep each row on a separate line }


How many rows with 6 stars are there on the American flag?

There are 50 stars in nine rows on the American flag. The number of stars per row are:First row: 6 starsSecond row: 5 starsThird row: 6 starsFourth row: 5 starsFifth row: 6 starsSixth row: 5 starsSeventh row: 6 starsEighth row: 5 starsNinth and last row: 6 starsThus, there are 5 rows of 6 stars and 4 rows of 5 stars.


How many rows with 5 stars are there on the American flag?

There are 50 stars in nine rows on the American flag. The number of stars per row are:First row: 6 starsSecond row: 5 starsThird row: 6 starsFourth row: 5 starsFifth row: 6 starsSixth row: 5 starsSeventh row: 6 starsEighth row: 5 starsNinth and last row: 6 starsThus, there are 5 rows of 6 stars and 4 rows of 5 stars.


How do you make the first row of a crochet?

The first row of a crochet project is usually a chain stitch row. Make a loop, insert the hook, engage the yarn, pull the engaged yarn through the loop and repeat.


What do stars in a row mean?

In a row means one after another on the same line. So "stars in a row" mean there are stars one after another all on the same line.


How do you write pascal tringle in php using while loop?

function pascal($depth){ $row = array(1); while($depth &gt; 0){ $newRow = array(1); for($n = 1; $n &lt; count($row); $n++){ $newRow[] = $row[$n - 1] + $row[$n]; } $newRow[] = 1; $depth --; echo implode(' ', $newRow) . "\n"; $row = $newRow; } }


How many stars on each row?

4 and 5 stars


C program for addition of two matrices?

I don't know the code, so I can't give it to you. But the algorithm is simple. Matrices are usually stored as 2 dimensional arrays. Say M and N. Then you make a loop, any loop, that goes through each row, during each loop, another loop will go over every single column (so row 1, col 1, then row 1, col 2, then etc.) Each time, the loop goes into row i and column j, add the entries of that row and column from M and N, (or M i,j + N i,j) and let it be the i,j's entry of the sum matrix. Do the code yourself.


How many stars in each row on American flag?

There is five rows...so.......there is ten stars in each row. :)


Which constellation has three stars in a row?

A few constellations have three stars in a row. The most famous one is probably Orion the Hunter - three stars in a row make up his belt. This constellation is visible in winter in the Northern Hemisphere and the summer in the Southern Hemisphere. Another constellation with three stars in a row is Scorpius the scorpion - only instead of the three stars being horizontal, the three stars are vertical and just to the right of Antares, the Scorpion's heart.


How did the 43 star flag join?

The 43-star United States flag, in use between 1890 and 1891, was arranged with eight stars on the top row, and seven stars on each of the five rows beneath. The first, third, and fifth row of stars are centralized, while the second and fourth row of stars are offset to the right.


How do you compare daffodils with stars?

The poet of nature ,William Wordsworth describes comparison about the daffodils that the row of daffodils looks like the endless row, the continuous row of shining stars in the Milky Way.Stars shine on the sky and the poet imagines that the daffodils are just like twinkling stars in the bright daylight.