Write a program that display star pattern program using nested for loop:
Write a program that display the following block using nested for loop:
star pattern program :
C++ programs:
C++ code:
Source code:
#include <iostream>/* iostream provides basic
input and output services for C++ programs */
using namespace std;
int main()// Th execution of program start with the main function
{//For loop
for(int i = 1; i <= 5; i++)
// Outer loop to handle number of rows
{
for(int j = 1; j <= 5; ++j)
// Inner loop to handle number column
{
cout << "* ";
}
cout << "\n";
// "\n" is the format specifiers used to enter a new line character
}
return 0;
}
0 Comments