Machine Problem 3 - NCP 1102
Machine Problem 3 - NCP 1102
MACHINE PROBLEM #3
LOOPING STATEMENTS
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
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