You are on page 1of 2

First Task

1-
a) Print the message "This is a C++ program" on one line.
b) Print the message "This is a C++ program" on two lines. End
the first line with C++ .
c) Print the message "This is a C++ program" with each word on
a separate line.
d) Print the message "This is a C++ program" Separate each
word from the next by a tab.

2- Show the output of:


a) cout<<”a b \t c d\ne f \t g h\n i j k l \r”;
b) cout<<”\t Your Name \t Your ID\n\n\n”;
c) int a= 7, b= 1;
cout<<”\ta”<<”\tb”;
cout <<b;
d) cout<<”Name\\ Alaa, Course\” Programming\””;
e) cout << "\top ba\na\\na";
f) int x = 13, y = 3;
cout << x/y << y/x << x%y;
g) cout << "\"\\nnow\"";

3- Correct the errors:


include<iostream
using name space std
int main
{
Int num=="56";
cout>>"hello "<<s1
}
4-
a) Write a program in C++ to find the Area and Perimeter of
a Rectangle.
b) Write a C++ program to check whether a number is even
or odd using if else.
c) Write a C++ program that count even numbers and count
odd numbers from 1 to 100 and print Both.
d) Write a C++ program that prompt from user to input 10
integers and check if number is odd or even and print it.
e) Write a program that prompt from user to input 20
numbers and check number positive or negative or zero
and print it.
f) Write a program to count numbers from 5 to 45 with
exception of 9, 15 , 17 ,45
g) Write a program to print numbers from 6 to 20 with
exception of 7
h) Write a program to print numbers from 20 to 1 and out of
loop when number equal to 12.
i) Write a program to print numbers from 0 to 15 with
exception of 5 , 7 and out of loop when num equal to 13

You might also like