FYBCS C Exercise_7

Set A . Write C programs for the following problems.

 1. Write a function isEven, which accepts an integer as parameter and returns 1 if the number is even, and 0 otherwise. Use this function in main to accept n numbers and check if they are even or odd. 

 2. Write a function, which accepts a character and integer n as parameter and displays the next n characters. 

 Set B . Write C programs for the following problems .

 1. Write a function isPrime, which accepts an integer as parameter and returns 1 if the number is prime and 0 otherwise. Use this function in main to display the first 10 prime numbers. 

 2. Write a function that accepts a character as parameter and returns 1 if it is an alphabet, 2 if it is a digit and 3 if it is a special symbol. In main, accept characters till the user enters EOF and use the function to count the total number of alphabets, digits and special symbols entered. 

 3. Write a function power, which calculates x^y. Write another function, which calculates n! Using for loop. Use these functions to calculate the sum of first n terms of the Taylor series: Taylor series: sin(x) = x - x^3/3!  + x^ 5 /5! 

Post a Comment

0 Comments