Skip to main content

Palindromic Pattern

 /* @ToDo 


   Palindromic Pattern
                1   
            2   1   2   
        3   2   1   2   3   
    4   3   2   1   2   3   4   
5   4   3   2   1   2   3   4   5   
   
*/


#include <iostream>
using namespace std;

int main(){
     #ifndef ONLINE_JUDGE
        freopen("../asset/input.txt","r",stdin);
        freopen("../asset/output.txt","w",stdout);
    #endif
    // Code here!!

   int ncin>>n;
   for(int i=1;i<=n;i++){
        for(int j=0;j<n-i;j++)
            cout<<"\t";
        int j=i;
        for(;j>1;j--)
            cout<<j<<"\t";        

        for(;j<=i;j++)
            cout<<j<<"\t";
        cout<<endl;
   }

    return 0;
}

Comments

Must Read:

Coin Change Permutations

 1. You are given a number n, representing the count of coins. 2. You are given n numbers, representing the denominations of n coins. 3. You are given a number "amt". 4. You are required to calculate and print the number of permutations of the n coins using which the       amount "amt" can be paid. Note 1: You have an infinite supply of each coin denomination i.e. same coin denomination can be                    used for many installments in payment of "amt" Note 2: You are required to find the count of permutations and not combinations i.e.                   2 + 2 + 3 = 7 and 2 + 3 + 2 = 7 and 3 + 2 + 2 = 7 are different permutations of same                    combination. You should treat them as 3 and not 1. Input Format A number n n1 n2 .. n number of elements A number amt Output Format A number representing the cou...

RDBMS Data Definition Language | Purge Distributor table Truncate

 RDBMS  Data Definition Language  Purge Distributor table Truncate The mobile management wants to purge all the records from the “Distributor “table.  Write an SQL statement to purge all the records from the distributor table without allowing rollback activity. Evaluation Result: Result Description Summary of tests +------------------------------+ | 1 tests run / 1 test passed | +------------------------------+

RDBMS Data Definition Language | Drop Sales Info table(child)

RDBMS  Data Definition Language  Drop Sales Info table(child) Refer the following schema and drop Sales Info table.   Evaluation Result: Result Description Summary of tests +------------------------------+ | 1 tests run / 1 test passed | +------------------------------+

Software Engineering Concepts Basics Of Testing Basics Of Testing | Quiz 2

Software Engineering Concepts  Basics Of Testing  Basics Of Testing Quiz 2

Data Formats ( XML & JSON ) XML AND JSON | Generate XSD for Persons

  Generate XSD for Persons Generate XSD for the following XML. XYZ organization wants to store the details of persons in an xml file. The following scenario helps in designing the XML document. Here PersonList  is the root tag. PersonList contains the entry of each person with adhaarno, name, age and address. <?xml version="1.0"  encoding="UTF-8"?> <PersonList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PersonList.xsd">     <Person>         <adhaarno>414356782345</adhaarno>         <name>             <firstname>Zeenath</firstname>         </name>         <age>28</age>         <address>             <doorno...

Programming using Java Hands On - Control Structures | Convert Numbers into Months

  Convert Numbers into Months Ram is very weak in converting the numbers into months. But his friends often tease him by asking him to do that. To solve his problem a close friend of him, suggested to meet IIT students, who were very good at programming. Help ram to resolve his problem. Note :  Range of inputs is 1 to 12. If the input given is beyond the range display error message as given in the sample output. Sample Input 1: 2 Sample  Output  1: February Sample Input 2: 15 Sample  Output  2: No month for the number 15 Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ | 6 tests run/ 6 tests passed | +------------------------------+

Mock 3 Slot3 - Handson - 21st July RDBMS (20 Marks) 1.1 Owner Details

  Write a query to display Owner id, Owner name and Contact details of owner from 'Coimbatore' or 'Bangalore'. For contact details, display the Email ID, if it is not available, display phone number. If both are not available, display ‘NA’. Give alias name as CONTACT_DETAILS. Sort the result based on Owner name in descending order. ( Hint : Retrieve data from Owners table , Data is  case sensitive) Evaluation Result: Result Description Summary of tests:(Note:Your query is evaluated against different datasets. Kindly do not Hardcode) +------------------------------+ | 2 tests run / 2 test passed | +------------------------------+

RDBMS Data Definition Language | Alter - Establish Referential Integrity Constraint

RDBMS  Data Definition Language  Alter - Establish Referential Integrity Constraint Identify the common key between the customer_info and Sales_info tables and establish referential integrity constraint between them. Give the constraint name as FK_KEY. Evaluation Result: Result Description Summary of tests +------------------------------+ | 3 tests run / 3 test passed | +------------------------------+

UNIX Introduction to Unix | Pre-Quiz

  Feedback Congratulations! You have passed by securing more that 80%. Question  1 Correct Mark 1.00 out of 1.00 Flag question Question text  Solaris is the name of a flavor of UNIX from _____________. Select one: a.  HP  b.  Sun Microsystems   c.  IBM  d.  Digital Equipment Corp Feedback Your answer is correct. The correct answer is: Sun Microsystems Question  2 Correct Mark 1.00 out of 1.00 Flag question Question text Match the following: HP-UX Answer 1 Choose... IBM Redhat Hewlett Packard Sun Microsystem   AIX             Answer 2 Choose... IBM Redhat Hewlett Packard Sun Microsystem   Linux Answer 3 Choose... IBM Redhat Hewlett Packard Sun Microsystem   Solaris Answer 4 Choose... IBM Redhat Hewlett Packard Sun Microsystem   Feedback Your answer is correct. The correct answer is: HP-UX → Hewlett Packard, AIX             → IBM, Linux → Redhat,...

Subscribe to Get's Answer by Email