logo codesdope

Practice questions of Let's start and Gear up.


Level 1
1.
Write a C++ program to print
*
**
***
****
on screen.
Answer
#include <iostream>
int main()
{
	using namespace std;
	cout << "*" << endl;
	cout << "**" << endl;
	cout << "***" << endl;
	cout << "****\n";
	return 0;
}
									

2.
Store an integer in a variable x and print it on the screen.
Answer
#include <iostream>
int main()
{
	using namespace std;
	int x = 5;
	cout << x << endl;
	return 0;
}
									

3.
Write a program to take the input of an int and print it on the screen.
Answer
#include <iostream>
int main()
{
	using namespace std;
	int x;
	cin >> x;
	cout << x << endl;
	return 0;
}
									

4.
Print the following pattern on the screen
****
 ** 
  *  
 ** 
****

5.
Write a program to print Hello and CodesDope in two different lines.

Doubt? Ask question
Close

Welcome.please sign up.

Close

Welcome.please login.