Author Topic: pattern of numbers example #2  (Read 878 times)

administrator

  • Administrator
  • Full Member
  • *****
  • Posts: 69
pattern of numbers example #2
« on: October 26, 2011, 10:31:19 am »
Enter a number: 6
1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6

Enter a number: 3
1 1 1
2 2 2
3 3 3

Source Code
Code:
//Source Code Listing

int main()
{
   int n = 0;
   printf("Enter a number: ");
   scanf("%d", &n);


   for(int i = 1; i <= n; i++)
   {
      for(int j = 0; j < n; j++)
         std::cout << i << " ";
      std::cout << "\n";
   }

	return 0;
}
« Last Edit: November 01, 2011, 05:44:10 pm by kathir »

dollor

  • Newbie
  • *
  • Posts: 8
Re: pattern of numbers example #2
« Reply #1 on: October 28, 2011, 03:53:47 am »
Thank you sir

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1