Assignment-4

 1. Write a C program that takes as input a single character from the user and check whether the entered character is a vowel or consonant.



 2. Write a C program that takes as input a single character from the user. If the character is an English alphabet in small case, it is converted to upper case and printed out. If the character is an English alphabet in upper case, it is converted to lower case and printed out. If the character is not an English alphabet in small case, then it is kept unchanged and printed out.



 3. Write a C program that prints the next character from the ASCII table for the corresponding character taken from the keyboard. As for example, if the character taken from the keyboard is ‘B’, the program will print the immediate next character ‘Ç’. Also print the corresponding ASCII value. 



 4. Write a C program to find the sum of the following series up to nth term, where x or n have to be taken from the user. Do not use the standard library function pow() for the computation of xn .

 (a) S=1+2+3+4+….up to nth terms

 (b)S=1+x+x2+x3+….up to nth terms 

 (c) S = 1+x+x2 /2!+x3 /3!+….up to nth terms 

 (d)S = 1-2+3-4+….up to nth terms 

 (e) S = 2+4+6+….up to nth terms 





 5. Write a C program to generate set of all prime numbers between 1 and n, where the number n has to be supplied by the user.



 6. Write a C program to generate Fibonacci sequence up to nth term where n is an input has to be taken from the keyboard. Write a main program to test it. The Fibonacci numbers are generated by setting F0=0, F1=1 and using the following formula to get the rest.

 Fn = Fn-1+Fn-2






Comments

Popular Posts