logo codesdope

Practice questions on Let's start

Level 1

1.

Write a C++ program to print
*
**
***
****
on screen.

#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.

#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.

#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.


Level 2

Level 3

Close

Welcome.please sign up.

Close

Welcome.please login.