C-Loops and Control Statement-7
C-Loops and Control Statement-7
C-Loops and Control Statement-7
3. Print Fibonacci series: - 1,1,2,3,5,8,13… (Hint: After the first two numbers
in the series, each number is the sum of the two preceding numbers.)
4. .Wap To read integers (until user enters 0 to stop); find sum, average, max
and min of these integers added by user.
5. Determine and print the sum of the following harmonic series for a
given value of n:
a. 1 + ½ + 1/3 + ¼ +. …+ 1/n
b. Given that PI = 4(1-1/3+1/5+1/9+1/14+…)
Write a program to evaluate the value of PI as the sum of 10 terms or
20 terms ,… or 100-terms and print as per the following format
c. No. of Terms | Value of PI
d. --------------------------------------
e. <<your ans>>
f. <<your ans>>
g. . .
h. . .
i. . .
j. <<your ans>>
k. *
6. Witnesses at the scene of a crime gave descriptions about two suspects who
were in hurry. The first suspect was described as being short and heavy (height
<165 cm and weight >90 kg) and the second suspect was described as being tall
and thin (height >190 cm and weight <60 kg). Write a c-program to input height
and weight of known criminal-pairs in the area and to printout it is suspect or
not.
a)Read above problem. Now read a no. N from user. Then read heights and
widths of N criminal-pairs and print whether they are criminals or not.
8 Write a do-while loop to evaluate and print the values of the quadratic
polynomial
y=x2+10x-11 for the value of x = 0.0 to 1.0 with steps 0.2.
9 Write a for loop to print the numbers between –1 and –30 and their squares
and cubes.
10 Read n numbers from user and find maximum and minimum of those
numbers.
11 Read numbers from user till he wants; also calculate sum of sum of positive
numbers and product of negative numbers.
13 1! + 2! + 3! + …+n!
14 X – X3/3! + x5/5!-x7/7!+…
15 Generate a menu-driven calculator that will accept two numbers from the
user and ask for the choice to add, subtract, multiply, divide or exit. After the
result is calculated and displayed as per the user’s choice; the program should
ask the user whether he wants to continue calculations or not.
21 Accept one character from user. Also accept a choice (‘v’ for vowel and ‘c’ for
non-vowel i.e. consonants) from user. The character entered by user should be
tested that is it vowel(‘v’) or non-vowel (‘c’) depending upon choice entered by
user; give proper output message. Repeat this process till user wants to continue.