0% found this document useful (0 votes)
6 views2 pages

Sheet-2 For

The document outlines various programming exercises for a C programming course at Fayoum International Technological University. It includes tasks such as calculating natural numbers, factorials, and summing odd integers, along with questions on iteration types and switch statements. Additionally, it contains fill-in-the-blank and true/false questions related to programming concepts.

Uploaded by

Abdullah Emam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Sheet-2 For

The document outlines various programming exercises for a C programming course at Fayoum International Technological University. It includes tasks such as calculating natural numbers, factorials, and summing odd integers, along with questions on iteration types and switch statements. Additionally, it contains fill-in-the-blank and true/false questions related to programming concepts.

Uploaded by

Abdullah Emam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Fayoum International Technological University

Faculty of Technology Information Communication Technology Program


Third Year – Advanced in C programming
Academic Year (2024/2025) Dr. Esraa El Hariri
JD-DEM: Abdullah Emam

Name: Sheet#1 ID:

1- program to find the first 10 natural numbers.

2- program to display n terms of natural numbers and their sum.


Sample Output:
Input a number of terms: 7
The natural numbers up to 7th terms are:
1234567
The sum of the natural numbers is: 28

3- Write a program that calculates the Factorial of the first 10 numbers

4- Write a program in C++ to print this pattern

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

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

a) Sum the odd integers between 1 and 99 using a for statement. Use the unsigned integer variables
sum and count.

b) Print the value 333.546372 in a field width of 15 characters with precisions of 1, 2, 3, 4 and 5.
Left justify the output. What are the five values that print?

c) Calculate the value of 2.5 raised to the power of 3 using the pow function. Print the re sult with
a precision of 2 in a field width of 10 positions. What is the value that prints?
Fayoum International Technological University
Faculty of Technology Information Communication Technology Program
Third Year – Advanced in C programming
Academic Year (2024/2025) Dr. Esraa El Hariri
JD-DEM: Abdullah Emam

Fill in the blanks in each of the following statements.

a) Counter-controlled iteration is also known as……………….. iteration because it’s known in advance how
many times the loop will be executed.
b) Sentinel-controlled iteration is also known as ………………..iteration because it’s not known in advance
how many times the loop will be executed.
c) In counter-controlled iteration, a(n)……………….. is used to count the number of times a group of
instructions should be repeated.
d) The ……………..statement, when executed in an iteration statement, causes the next iteration of the
loop to be performed immediately.
e) The ……………..statement, when executed in an iteration statement or a switch, causes an immediate
exit from the statement.
f) The …………….. is used to test a particular variable or expression for each of the constant integral
values it may assume.

State whether the following are true or false. If the answer is false, explain why.

a) The default case is required in the switch selection statement.


b) The break statement is required in the default case of a switch selection statement.
c) The expression (x > y && a < b) is true if either x > y is true or a < b is true.
d) An expression containing the || operator is true if either or both of its operands is true.

You might also like