Turbo C

Submitted by: Submitted by

Views: 161

Words: 436

Pages: 2

Category: Other Topics

Date Submitted: 03/19/2014 04:21 AM

Report This Essay

1. Write a program that will ask the user to enter a number n and display all the numbers from 1 to n on a single line.

2. Write a program that will ask the user to enter a number n and display the sum of all numbers from 1 to n.

3. Write a program that asks the user to enter a number n and display the first n even numbers. Example: if n=5, the first even numbers are 2,4,6,8 and 10.

4. Write a program that asks the user to enter a number n and display the first n odd numbers. Example: if n=5, the first 5 odd numbers are 1,3 ,5,7 and 9.

5. Write a program that will compute for n! (n factorial) which is the product of all numbers from 1 to n.

6. Write a program that will compute for and display the sum of all numbers divisible by 3 from 1 to 1000.

7. Write a program that will ask the user to enter a number and display all the factor of the number.

8. Write a program that will accept a number n and display the sum of all even numbers and the sum of all odd numbers from 1 to n.

9. Write a program that will display the following pattern, given the value of n. Example: if n=4, output

*

**

***

****

10. Write a program that will display the following pattern, given the value of n. Example: if n=4, output

****

***

**

*

11. Write a program that will display the following pattern, given the value of n. Example: if n=4, output

*

**

***

****

12. Write a program that will display the following pattern, given the value of n. Example: if n=4, output

****

***

**

*

13. Write a program that will display the following pattern, given the value of n. Example: if n-4, output.

4321

321

21

1

14. Write a program that will display the following pattern, given the value of n.

Example: if n=4,output

1234

123

12

1

15. Write a program that will display the following pattern, given the value of n and m. Example if n=4, and m=3, output

* ***

****

****...