Docstoc

q1 www jecguide com

Document Sample
q1 www jecguide com Powered By Docstoc
					       www.jecguide.com



Q1. Write a C program to generate ‘n’ numbers of Fibonacci series in descending order. Value of
‘n’ is entered by user. For example, if user enters 7 for ‘n’ then the output is ---
                               8 5 3 2 1 1 0


Q2.Write a C program to find the factorial of any number entered by user. Function should be
used to calculate the factorial value and result should be printed from main( ).


Q3. Write a C program to interchange values of two variables using function and pointer.



Q5.Write a C program to find the difference between cube and square of any real number entered
by user. Create separate functions for calculation of cube and square.



Q6. Write a menu driven C program with the following options-
           1. Addition of two numbers
           2. Average of two numbers
           3. Generation of first 10 natural numbers
           4. Division of two numbers
           5. Exit from program
      Menu should keep reappearing on the screen. User should be able to exit from the
      program ONLY by selecting option 5.



Q7.Write a C program to reverse a number entered through the keyboard and also find it’s binary
equivalent.



Q8. Write a C program to display ‘n’ lines of the following figure. Value of ‘n’ is entered by
user.


                                                1
                                            2        2
                                        3       3        3
                                    4       4        4       4
                                5       5       5        5       5
         www.jecguide.com




Q9. Write a C program to display ‘n’ lines of the following figure. Value of ‘n’ is entered by
user.

     1
     2    2
     3    3 3
     4    4 4     4
     5    5 5     5   5

         Also find the sum of all numbers of the figure.




Q10. Write a C program to determine whether a matrix is symmetric or not.




Q11. Write a C program to find the multiplication of two matrices.



Q12.Write a C program where main( ) accepts any number entered by user and sends it to a
function for calculation of sum of individual digits of the number. Display the sum from main( ).



Q13. Write a C program where user inserts radius of circle in main( ). Calculate area and
perimeter of the circle in a single function and print the results from main( ). [ area=
3.14×radius×radius and perimeter= 2×3.14×radius ]



Q14. Write a C program where main( ) accepts values for two variables ‘a’ and ‘b’ from user.
                                             b
Create a user defined function to calculate a and print the result from main( ). [ for example, if
user enters 2 and 3 then result is 8 ]
       www.jecguide.com



Q15.Write a C program to generate all Armstrong numbers between 1 and 500. If sum of cubes
of each digit of the number is equal to the number itself, then the number is called an Armstrong
number. For example ,153 =(1×1×1)+(5×5×5)+(3×3×3).




Q16. Employee’s basic salary is input through the keyboard. Write a C program where a function
calculates the gross salary and print it from main( ). Consider dearness allowance as 50% of
basic salary, house rent allowance as 10% of basic salary . Gross salary is the sum of basic,
dearness allowance and house rent allowance.



Q17. Students’ marks of five subjects are entered through the keyboard. Write a C program
where a function calculates the average mark. If the average is less than 50 then display ‘grade F’
else display ‘grade P’ from main ( ).



Q18. Allow user to enter ‘n’ numbers into an array. Write a C program to copy the even and odd
numbers of the array into separate arrays and display them. Also display the difference between
the sum of even numbers and the sum of odd numbers. Value of ‘n’ is input by the user.



Q19.Ask user how many numbers he/she wants to enter and allow him/her to insert the numbers
into an array. Write a C program to find the difference between the largest and smallest number
of the array.



Q20. Write a C program to check whether a string entered by user is palindrome or not.




Q21.Write a C program to convert all lowercase characters of a string to its equivalent uppercase
character.
       www.jecguide.com



Q22. A library charges a fine for every book returned late. For first five days the fine is 50 paise
per day, for 6-10 days fine is one rupee per day and above 10 days fine is 5 rupees per day. If
you return the book after 30 days your membership will be cancelled. Write a C program to
accept the number of days the member is late to return the book and display the fine or
appropriate message.




Q23. If the three sides of a triangle are entered through the keyboard , write a C program to
check whether the triangle is valid or not. The triangle is valid if the sum of the two sides is
greater than the largest of the three sides.



Q24. Create a notepad file ‘exam.txt’ on D drive and write your name and college name in two
lines in the file. Write a C program to count total number of characters and lines present in the
text file.



Q25.Write a C program to find the sum of the following series

      12 + 22 + 32 + 42 +…………up to n terms




Q26. Write a C program to find the sum of the following series

      13 + 23 + 33 + 43 +…………up to n terms




Q27.Write a C program to find the square of sum of the following series

      1+3+5+7 +…………up to n terms. For example for n=3, output is 81.
       www.jecguide.com




Q28. Write a C program to find the sum of the following series

      1 + 3 + 2 + 4 + 5 + 7 + …….. up to n terms




Q29. Write a C program to check whether a number entered by user is prime or not.




Q30. Write a C program to allow user to enter two numbers and generate all Fibonacci numbers
between these two numbers. (Both number inclusive)



Q31. Write a C program to print all prime numbers from 1 to 300.



Q32. Write a C program to add first n terms of the following series-

    1/1! + 2/2! + 3/3! + ………



Q33. Ten numbers are entered from keyboard into an array. User will enter a number which is to
be searched in the array. Write the C program to search the number . If it is present ,display the
number of times it appears in the array.


Q34. Ten numbers are entered from keyboard into an array. Write a C program to find the
smallest number in the array. Use a function to calculate square of this number.


Q35. Write a C program to enter ten numbers into an array and then find the largest number and
calculate the cube of the largest number using function.

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:167
posted:3/5/2010
language:English
pages:5