shaadi.com

Searching...
Friday, 31 May 2013

C language Programming inspired to St.Xavier's College Ahmedabad

Write a program for the following:-
-------------------------------------


*  Input a number to check if it is Prime number or Composite.

* To find the Product of two numbers entered without using multiplication operator.

*  Count the number of digits in the given number.

*   Find if the number entered is, Perfect number or not a perfect number.
[Hint: Perfect number is a number which is equal to sum of its factors.
Note: Number itself should not be included as its factor.
eg.   6=1+2+3 , 28=1+4+7+14 ]

*   Display n terms of the Fibonacci series;[ 0,1,1,2,3,5,8,13,........] .
[Hint: Term is equal to sum of its previous and its prev no.]


*   Check if the entered number is Armstrong number ?
[Hint: Armstrong number is equal to the sum of the cubes of its digits.
eg.   153 = 1^3 + 5^3 + 3^3 ]

*   Display if the accepted number is Automorphic number ?

[Hint: Automorphic number is one whose Square if taken,
then in the result if last digit(s) should be equal to the number itself.
1^2 =1 , 5^2=25 , 6^2=36 , 25^=125 are some examples.]
-    -   -    -   -    -   --   --

*   Display the reverse of the number entered.

*   Check if the number entered is Palindrome number ?
[Hint: Palindrome number is a number which is equal to its reverse number.
eg.   121 reverse is 121 as same hence palindrome.
123 -"-        321 not same -"- not palindrome ]


*  Find the sum of the given series:
 i)  Cubes of odd numbers between 1 to 100.
ii)  2 + (2 + 4) + (2 + 4 + 6) + (2 + 4 + 6 + 8)....



Digits Based
***************************************************
*   Seperate digits of the number entered.
[Hint: 534 number's seperate digits are 5  3  4 or as 4 3 5]

*   Find Highest digit in a number entered.
[Hint: 7832 (number) => 8 (highest digit) ]

*   Find Sum of the digits in a number entered.
[Hint: 7832 ,Sum=7+8+3+2 ]

*   Enter 4 digit number, then find Sum of the first digit & last digit.
[Hint: 7832 ,Sum=7 + 2 ]

*   Display those digits in a number entered, which are Prime Numbers.
[Hint: 7832 ,Prime numbers are 7,3,2 ]

*   Sum up the digits of the no. till it is reduced to a single digit.
[Hint: 935 =>9+3+5=17  17=>1+7=8 8 is single digit]

0 comments:

Post a Comment