Computer Science, asked by ajinkyabiyani, 9 months ago

Write a program in C++ to print the following pattern.

Sample Input:

3

Sample Output:

3
44
555
6666
6666
555
44
3

Answers

Answered by sumitrawat1991
0

Answer:

If you need to input a string with whitespace characters (or strings with blank spaces as you call it) until a newline character is encountered, set the delimiter to '\n' character by using: scanf(" %[^\n]s",str);

https://www.quora.com › In-C++-ho...

In C++, how can I input

Answered by Yamini1999
1

Answer:

#include<iostream>

using namespace std;

int main()

{

 int n;

 cin>>n;

 for(int i=n;i<=n+3;i++)

 {

   for(int j=0;j<=i-n;j++)

   {

     cout<<i;

   }

   cout<<"\n";

 }

   for(int i=n+3;i>=n;i--)

 {

   for(int j=0;j<=i-n;j++)

   {

     cout<<i;

   }

   cout<<"\n";

 }

}

Explanation:

Similar questions