Do In Lab (27-02-2013)

Post date: Feb 27, 2013 6:54:39 AM

Q1. Write a c++ program that computes the equation (Y) to the power of (X) and print the result on file.

------------------------------------------------------------------------------------------------------------------------

Enter X : 4

Enter Y : 2

The result is : 16

Q2. Write a c++ program that reads 10 numbers then counts even and odd numbers and store the result on a file.

-----------------------------------------------------------------------------------------------------------------------------------

Enter a number : 1

Enter a number : 2

Enter a number : 3

Enter a number : 4

Enter a number : 5

Enter a number : 6

Enter a number : 7

Enter a number : 8

Enter a number : 9

Enter a number : 11

Odd Numbers : 6

Even Numbers : 4

Q3. Write a c++ program loop that starts with 1 and ends with 40 the program must print each 5 numbers on a row:

------------------------------------------------------------------------------------------------------------------------------------

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17 18 19 20

21 22 23 24 25

26 27 28 29 30

31 32 33 34 35

36 37 38 39 40 -> and put it on a file.

Q4. Write a c++ program that adds the numbers from (1.0 + 1.5 + 2.0 + 2.5 + … + 9.0 + 9.5 + 10.0).

-----------------------------------------------------------------------------------------------------------

Result = 104.5