C++ program *** *** ***

Write a program that reads in a number n and prints out n rows each containing n star characters, '*'.  
Thus if n is 3, then your program should print

***
***
***

code:


#include <iostream>
int main()
{
  int i,n,k;
  scanf("%d",&n);
  for(i=1;i<=n;i++)
  {
    for(k=1;k<=n;k++)
    {
      printf("*");
    }
    printf("\n");
  }
}


Comments