Ganapathy the Mathematics professor distributed the answer sheets for his students after the examination. His class had students who have passed the exam as well as the students who have failed in the exam.
In order to have the proper analysis of individual student performances in his class he have ordered them to sit in the order were the students passed the exam should sit in ODD numbered row and the students who have failed in exam should sit in EVEN numbered row.
The total number of rows in which students have to sit will be given by the professor. But since the dimension of the class is triangular in shape the students got confused.
Can you help them with the order in which they have to sit if the number of rows is given by the professor?
Input:
Only line of input has single integer representing the number of rows in which students have to sit.
Output:
Print the seating layout in a triangular shaped class according to the number of rows.
#include <stdio.h> int main() { int noofrowsinclass;int i,j; scanf("%d",&noofrowsinclass); for(i=1 ;i<=noofrowsinclass;i++) { for(j=1;j<=i;j++) { if(i%2==0) { printf("Fail "); } else { printf("Pass "); } } printf("\n"); } return 0; }
INPUT_1:
11
OUTPUT:
Pass
Fail Fail
Pass Pass Pass
Fail Fail Fail Fail
Pass Pass Pass Pass Pass
Fail Fail Fail Fail Fail Fail
Pass Pass Pass Pass Pass Pass Pass
Fail Fail Fail Fail Fail Fail Fail Fail
Pass Pass Pass Pass Pass Pass Pass Pass Pass
Fail Fail Fail Fail Fail Fail Fail Fail Fail Fail
Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass Pass
INPUT_2:
8
OUTPUT:
Pass
Fail Fail
Pass Pass Pass
Fail Fail Fail Fail
Pass Pass Pass Pass Pass
Fail Fail Fail Fail Fail Fail
Pass Pass Pass Pass Pass Pass Pass
Fail Fail Fail Fail Fail Fail Fail Fail
Morae Q!
- Conversion of days into year, weeks and days.
- Find if the number is a perfect number or not.
- Compute conversion of Binary to Octal.
- Return the sum of digits in a number.
- Find if a word exists or not in a sentence.
- Convert Numbers into Words.
- Read a word if it consists only of the letters known.
- Check if the string is a dynamic string or not.
- Convert all Uppercase letters to Lowercase and vice-versa.
- Change the string such that there are no matching adjacent characters.
- Find the number of sub-strings which start and end both in 1.
- Find the start and end index of unsorted sub-array.
- Find the maximum number of pairs that can be formed.
- Figure out the number of bubbly words present.
- Check if a string is lapindrome or not even with a middle character.
- Seating layout in a triangular shaped class according to the number of rows.
- Find and Sort a sub-array which makes whole array sorted.
- Seating layout according to the number of rows.
- Find the final states of the bulbs.
- Check if reversing sub array makes the array sorted.