WEEK:1 PROGRAMMING ASSIGNMENT 2 SOLUTION (Jan 2020-Apr2020) An Introduction to Programming through C++ NPTEL 2020

    

               An Introduction To Programming Through C++


IIT Bombay.

CLICK HERE FOR WEEK 3 PROGRAMMING ASSIGNMENTS


Week 1 - Programming Assignment 2:


*.Write a program that reads in a number and prints out the letter T using '*' characters with each line in the T having width n.  Further, the length of the horizontal bar should be 3n, and that of the vertical bar 2n.  Thus for n=3 your program should print

*********
*********
*********
   ***
   ***
   ***
   ***
   ***
   ***

TEST CASES:

Sample Test Cases

Test Case 1


Input Output
3        *********
          *********
          *********
              ***
              ***
              ***
              ***
              *** 
              ***

PROGRAM:

#include <iostream>
using namespace std;
main_program
{
  int n; 
  cin >> n;

  repeat(n){
    repeat(3*n){
      cout <<'*';
    }
    cout << endl;
  }

  repeat(2*n){
    repeat(n){
      cout <<' '; 
    }
    repeat(n){
      cout <<'*';
    }
    cout << endl;
  }
} 

WEEK :2 ASSIGNMENT 2 MCQS SOLUTION
CLICK ON BELOW LINK.
<<CLICK HERE FOR ASSIGNMENT 2 MCQS WEEK 2>>

FOLLOW OUR WEBSITE FROM THE BUTTON PROVIDED TO THE BOTTOM OF PAGE TO GET SOON ANSWERS OF PROGRAMS.
Disclaimer: Here you can find all nptel assignment solutions related to CS stream.These may help you for your assignment.The answers are only for verification.You cannot copy these directly from the post(code of conduct of NPTEL).These is not 100%  correct solutions.

No comments:

Post a Comment

If you have any problems related to solutions or any concept please let me know.

Copyright (c) 2020 Custom Programs All Right Reserved

Pages