Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

ECE-C CSE102 – Computer Programming Assignment-1

(Need to be summited on: 17.01.2018 FN)

1. Separate the even and odd numbers in an array of 20 elements into two
different arrays and give the count of elements present in each array.

2. Write a program to find out whether entered string is armstrong number or not
using function.
(eg) if input is 153 . so it is an armstrong number.

3. Write a program to display a list of first n prime numbers. Give n as input.

4. Write a program to display a given integer value in to binary value. (if input is
10 output is 1010)

5. In a company an employee is paid as given below.If his basic salary is less than
Rs.1500 then HRA=10% of basic salary and DA=25% of basic salary.If his
salary is either equal to or above Rs.1500 then HRA=Rs.500 and DA=50% of
basic.If the employee’s salary is input through the keyboard write a program to
find the gross salary which is the sum of basic salary and HRA and DA.

6. Write a program to read a string and rewrite it in the alphabetical order. ( if


input is welcome ouput is celmow).

7. Write a program to find the range value of n numbers using array


(range=max.value – min.value)

8. Write a program that reads 10 integers and prints the first and the last on one
line,the second and the ninth on the next line,the third and the seventh on the
next line, and so forth.
sample input: 0 1 2 3 4 5 6 7 8 9
ouput: 0 9
1 8
2 7
3 6
4 5

9. Write a program to read an amount from the user and count number of five
hundreds, hundreds, fifties ,twenties ,tens ,fives ,twos and ones.
sample input:2592
output: 5 - five hundreds
0 – hundreds
1 - fifties,0 - twenties
4 - tens ,0 - fives ,1 - twos ,0-ones
if input is 2592 then output is 5->500’s , 0->100, 1->50, 0->20’s, 4->10’s, 1-
>2.(5*500+0*100+1*50+0*20+4*10+1*2)

10.Write a program to print the following series:


6, 8, 10,12..........66
35, 30, 25, 20, 15, 10, 5, 0, -5, -10, -15, -20, -25, -30, -35
7, 9, 11, 13..........67

11.Write a program to print a number backward and check whether that number is
palindrome or not.

12.write a program to print the ascii value for the char that the user entered.
1. Write a program to calculate the following:
1!+2!+3!+……..+n!

13.Write program to convert a given number of days in to months and years.

14.Write a program to find out the roots of a quadratic equation by getting values
for a,b,c.

15.Write a program to find the sum of all integers between 100 to 200 which are
divisible by 8.

16. Write a program using switch case to display a day in a week. Declare
enumeration identifier as day and include days as values.

17.Write a program to find second minimum of given 3 numbers using function.


(flowchart)

18. Write a program to get a value for x ,n and find x1+x2+x3+….+xn using
function.

19.Write a program to compute 1!+2!+3!+……+n!. (pass function as a argument


to other function. One function to compute factorial values and another one to
all the factorial values).

20.a) Write a program to find the factorial of a number.


b) Write a program that will read the value of x and evaluate the following
function.
y=1 for x>0
=0 for x=0
=-1 for x<0
Using:
a) nested if statements
b) else if statements

You might also like