Assignment 1: (CO1, CO2)
Questions:
1) Draw a flowchart and write a c-programm that prints numbers from 1 to 10.
Ouput: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
2) Draw a flowchart and write a c-program that prints the sum of first N Natural Numbers.
Example:
Input: 5
Output: The sum of first 5 natural numbers is 15.
3) Draw a flowchart and write a program to find the factorial of a given number by the user.
Example:
Input: 5
Output: 5! = 120
4) Draw a flowchart and write a program that takes an integer and prints its multiplication table
up to 10.
Example:
Input: 5
Output:
5x1=5
5 x 2 = 10
.
.
5 x 10 = 50
5) Draw a flowchart and write a program that prints all the numbers from 10 to 1 in descending
order.
Example:
Output: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
6) Draw a flowchart and write a program to count the number of digits in a given number.
Example:
Input: 2890208
Output: The number of digits are 7.
7) Draw a flowchart and write a program to find the sum of the digits of a given number.
Example:
Input: 18121036
Output: The sum of the digits are 22.
8) Draw a flowchart and write a program to check whether a given number is prime or not.
Example:
Input: 5
Output: The number is prime.
9) Draw a flowchart and write a program to generate the first N terms of the Fibonacci series.
The value of N must taken from user.
Example:
Input: 10
Output: The first 10 numbers in Fibonacci series are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34.
10) Draw a flowchart and write a program to check whether a given number is an Armstrong
number or not.
Example:
Input: 153
Output: The number 153 is an Armstrong Number.
11) Draw a flowchart and write a program to print the following pattern using nested for loops:
*
**
***
****
*****