0% found this document useful (0 votes)
42 views1 page

Write A Program To Enter Any Number From User and Check Whether The Number Is

The document provides 8 exercises for an advanced computer programming laboratory focusing on looping statements. The exercises involve writing programs to: 1) print natural numbers from 1 to n using a loop, 2) print numbers from n to 1 in reverse order using a loop, 3) reverse a user-input number, 4) convert a number to words, 5) print all factors of a given number, 6) find the highest common factor of two numbers, 7) check if a number is an Armstrong number, and 8) print the Fibonacci series up to n terms.

Uploaded by

topherski
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)
42 views1 page

Write A Program To Enter Any Number From User and Check Whether The Number Is

The document provides 8 exercises for an advanced computer programming laboratory focusing on looping statements. The exercises involve writing programs to: 1) print natural numbers from 1 to n using a loop, 2) print numbers from n to 1 in reverse order using a loop, 3) reverse a user-input number, 4) convert a number to words, 5) print all factors of a given number, 6) find the highest common factor of two numbers, 7) check if a number is an Armstrong number, and 8) print the Fibonacci series up to n terms.

Uploaded by

topherski
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/ 1

ADVANCED COMPUTER PROGRAMMING

LABORATORY EXERCISE NO. 4


LOOPING STATEMENTS

1. Write a program to print all natural numbers from 1 to n using looping where n
is any number.
2. Write a program to print all natural numbers in reverse from n to 1 looping
where n is any number.
3. Write a program to enter any number from user and find the reverse of
number. Example:
Input: 1234
Output: 4321
4. Write a program to enter any number and convert it into words.
Example:
Input: 1234
Output: One Two Three Four

5. Write a program to enter any number and print all factors of given
number. Example:
Input any number: 12
All factors of 12 are: 1, 2, 3, 4, 6, 12
6. Write a program that enters two numbers and find the HCF(Highest Common
Factor) of the two numbers.
Example:HCF of 12 and 30 is 6
7. Write a program to enter any number from user and check whether the number is
Armstrong number or not. Armstrong number is a special number whose sum of
cube of its digits is equal to the original number.
Input: 371
Output: Armstrong number
371 is an Armstrong number because 3 3 + 73 + 13 = 371

8. Write a C program to print Fibonacci series upto n terms. Fibonacci series is a


series of numbers where the current number is the sum of previous two terms.
Example: 0, 1, 1, 2, 3, 5, 8, 13, 21...

You might also like