CP Lab-4

Post date: Oct 17, 2017 10:27:07 AM

1. Write a program to print the Fibonacci series till the number N. (Using while Loop) The sequence of Fibonacci numbers is defined recursively f0 = 0, f1 = 1, fi+1 = fi + fi-1 Here i = 1, 2, 3, ….. So the sequence is like 0 1 1 2 3 5 8 13 21 …… Example: N = 50, the sequence will be 0 1 1 2 3 5 8 13 21 34

2. Write a C programm using While loop to print the following series for N terms (N should be accepted from the user) 1+4+7+10+13+16+19+...+N You also need to print the sum for the above series.

3. Write a menu driven program to print the ASCII value(s) of individual or a rang or all from 0 to 255.

You are required to use while loop for the same. Ex. Welcome to do-while demonstration. What whuold you like to do

Menu: 1. individual ASCII value 2. A range of ASCII value 3. All the ASCII value between 0 to 255 Choice: 1 Enter the integer value between 0 and 255: 71 The ASCII value equivalent to 71 is G. Menu: 1. individual ASCII value 2. A range of ASCII value 3. All the ASCII value between 0 to 255 Choice: 2 Enter the range of ASCII Values: 100 108 The ASCII value between 100 and 108 are d e f g h i j k l Choice: 3