Skip to main content

Inverted Pattern

 /* @ToDo 


Inverted Pattern
1   2   3   4   5   
1   2   3   4   
1   2   3   
1   2   
1   

*/


#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 n; cin>>n;
    for(int i=0;i<n;i++){
        for(int j=1;j<=n-i;j++)
            cout<<j<<"\t";
        cout<<endl;
    }
    return 0;
}

Comments

Must Read:

Programming using Java Hands On - Arrays | Find & Display the position of a number

  Write a java program to find the given number from the array of elements and display its position. If the number is not present in an array then display it as 0. Assume the position starts from 1. Sample Input 1 Enter the array size 4 Enter the values 9 32 17 4 Enter the number to find 17 Sample Output 1 3 Sample Input  2 Enter the array size 3 Enter the values 29 53 11 Enter the number to find 49 Sample Output  2 0 Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ |4 tests run / 4 tests passed | +------------------------------+ TEST CASE PASSED

RDBMS Data Definition Language | Create Distributor table

  Write a query to create Distributor table with constraints mentioned.  Refer the below schema  Result Description Summary of tests +------------------------------+ | 3 tests run / 3 test passed | +------------------------------+

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

Software Engineering Concepts  Basics Of Testing  Basics Of Testing Quiz 2

DH ASE B3 Slot 3 Mock 1 - Quiz

 DH ASE B3       Slot 3            Mock 1                 Quiz

Programming using Java Hands On - Control Structures | Highest Placement

  Highest Placement SRV college wants to recognize the department which has succeeded in getting the maximum number of placements for this academic year. The departments that have participated in the recruitment drive are CSE,ECE, MECH. Help the college find the department getting maximum placements. Check for all the possible output given in the sample snapshot Note : If any input is negative, the output should be "Input is invalid".  If all department has equal number of placements, the output should be "None of the department has got the highest placement". Sample Input 1: Enter the no of students placed in CSE:90 Enter the no of students placed in ECE:45 Enter the no of students placed in MECH:70 Sample  Output 1: Highest placement CSE Sample Input 2: Enter the no of students placed in CSE:55 Enter the no of students placed in ECE:85 Enter the no of students placed in MECH:85 Sample  Output 2: Highest placement ECE MECH Sample Input 3: Enter the no of students p...

RDBMS Data Definition Language | Create Mobile_master table

  Write a query to create Mobile_master table with constraints mentioned.  Refer the below schema  Result Description Summary of tests +------------------------------+ | 3 tests run / 3 test passed | +------------------------------+

Programming using Java Hands On - Control Structures | Income Calulation

Income Calculation In a company named Micky software solution, many part-time employees are working for a pay of Rs. 100 per hour. Write a program to calculate the total amount an employee earns in a year by working part time. Consider employees should work all day in the year and year has 365 days. Note : The hour should be a positive value less than or equal to 24, if fails display "Unable to calculate the earnings" Sample Input 1: Enter no of hours worked in a day:3 Sample Output   1 : Total income in a year:109500 Sample Input 2: Enter no of hours worked in a day:-5 Sample Output   2 : Unable to calculate the earnings Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ | 6 tests run/ 6 tests passed | +------------------------------+

Cars and Bikes Problem Code: TYRES | CodeChef

Problem: Chef opened a company which manufactures cars and bikes. Each car requires   4 4  tyres while each bike requires  2 2  tyres. Chef has a total of  N N  tyres ( N N  is even). He wants to manufacture maximum number of cars from these tyres and then manufacture bikes from the remaining tyres. Chef's friend went to Chef to purchase a bike. If Chef's company has manufactured even a single bike then Chef's friend will be able to purchase it. Determine whether he will be able to purchase the bike or not. Input Format The first line contains an integer  T T  denoting the number of test cases. The  T T  test cases then follow. The first line of each test case contains an integer  N N  denoting the number of tyres. Output Format For each test case, output  YES  or  NO  depending on whether Chef's friend will be able to purchase the bike or not. Output is case insensitive. Constraints 1 ≤ T ≤ 100 1 ≤ T ≤...

Programming using Java Hands On - Control Structures | Bill Generation

Bill Generation Tom went to a movie with his friends in a multiplex theatre and during break time he bought pizzas, puffs and cool drinks.  Consider   the following prices :  Rs.100/pizza Rs.20/puffs Rs.10/cooldrink Generate a bill for What Tom has bought. Sample Input 1: Enter the no of pizzas bought:10 Enter the no of puffs bought:12 Enter the no of cool drinks bought:5 Sample Output 1: Bill Details No of pizzas:10 No of puffs:12 No of cooldrinks:5 Total price=1290 ENJOY THE SHOW!!! Result Description Summary of tests *Note: All the test cases might not have same weightage +------------------------------+ | 6 tests run/ 6 tests passed | +------------------------------+

Subscribe to Get's Answer by Email