0% found this document useful (0 votes)
16 views11 pages

Machine Problem 3 - NCP 1102

Answer

Uploaded by

Isaac S Cruz
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)
16 views11 pages

Machine Problem 3 - NCP 1102

Answer

Uploaded by

Isaac S Cruz
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/ 11

NCP 1102

MACHINE PROBLEM #3
LOOPING STATEMENTS

NAME: CRUZ, JOHN ISAAC S PROFESSOR: DR.JOAN LAZARO


SECTION: 1CPE-1B DATE: 11-19-24 GRADE:

1. Write a code for the following display using any loops.


a. 9 b. 117 c. 1
12 104 1
15 91 2
18 78 4
21 65 7
24 52 11
27 39 16
30 26 22
33 13 29
36 0 37

d. 14 e. 2 f. 1
13 6 1
12 12 2
11 20 3
10 30 5
9 42 8
8 56 13
7 72 21
6 90 34
5 110 55

2. Build a code for the following display using nested loops.


a. ***** b. *
**** **
*** ***
** ****
* *****

c. 5 4321 d. 1 2345
5 432 1 234
5 43 1 23
5 4 1 2
5 1

1 | Page
NCP 1102

3. Create a C program that will display “I will pass NCP 1102” 10 times using
any loops.

4. Design a program using C that will input 20 integers and display the sum
using any loops.

5. Write a code that will loop by inputting any integer and displays whether
the integer is “POSITIVE” or “NEGATIVE”, and terminate the loop if the
integer is equal to zero using any loops.

6. Build a program that will display all prime numbers from 1 to 1000 using
looping.

ANSWER:
1.)
a.)

b.)

2 | Page
NCP 1102

c.)

d.)

3 | Page
NCP 1102

E.)

F.)

4 | Page
NCP 1102

2.)
A.)

5 | Page
NCP 1102

B.)

C.)

6 | Page
NCP 1102

D.)

3.)

7 | Page
NCP 1102

4.)

8 | Page
NCP 1102

5.)

9 | Page
NCP 1102

6.)

10 | Page
NCP 1102

11 | Page

You might also like