1. Question:Definition of Palindrome number or What is palindrome number? 

    Answer
    A number is called palindrome number if it is remain same when its digits are reversed. For example 121 is palindrome number. When we will reverse its digit it will remain same number i.e. 121
    Palindrome numbers examples: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191 etc.

    1. Report
  2. Question:What is an Armstrong number? Define according to c programming point of view 

    Answer
    Those numbers which sum of the cube of its digits is equal to that number are known as Armstrong numbers. For example 153 since 1^3 + 5^3 + 3^3 = 1+ 125 + 9 =153
    Other Armstrong numbers: 370,371,407 etc.
    In general definition:
    Those numbers which sum of its digits to power of number of its digits is equal to that number are known as Armstrong numbers.Example 1: 153
    Total digits in 153 is 3
    And 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153Example 2: 1634
    Total digits in 1634 is 4
    And 1^4 + 6^4 + 3^4 +4^4 = 1 + 1296 + 81 + 64 =1634
    Examples of Armstrong numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 153, 370, 371, 407, 1634, 8208, 9474, 54748, 92727, 93084, 548834, 1741725

    1. Report
  3. Question:Define strong number. 

    Answer
    A number is called strong number if sum of the factorial of its digit is equal to number itself. For example: 145 since
    1! + 4! + 5! = 1 + 24 + 120 = 145

    1. Report
  4. Question:What is Fibonacci series? 

    Answer
    We assume first two Fibonacci are 0 and 1
    A series of numbers in which each sequent number is sum of its two previous numbers is known as Fibonacci series and each numbers are called Fibonacci numbers. So Fibonacci numbers isAlgorithm for Fibonacci series
    Fn = Fn-2 + Fn-1Example of Fibonacci series:
    0 , 1 ,1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 , 55  ...
    
    5 is Fibonacci number since sum of its two previous number i.e. 2 and 3 is 5
    8 is Fibonacci number since sum of its two previous number i.e. 3 and 5 is 8 and so on.

    1. Report
  5. Question:Define Factorial. 

    Answer
    Factorial of number is defined as:
    Factorial (n) = 1*2*3 … * n
    For example: Factorial of 5 = 1*2*3*4*5 = 120
    Note: Factorial of zero = 1

    1. Report
  6. Question:What is Floyd’s triangle? 

    Answer
    Definition of floyd's triangle:
    Floyd's triangle is a right angled-triangle using the natural numbers. Examples of floyd's triangle:Example 1:
    1
    2 3
    4 5 6
    7 8 9 10Example 2:
    1
    2   3
    4   5   6
    7   8   9   10
    11  12  13  14  15
    16  17  18  19  20 21

    1. Report
  7. Question:Definition of LCM (Least common multiple): 

    Answer
    LCM of two integers is a smallest positive integer which is multiple of both integers that it is divisible by the both of the numbers.
    For example: LCM of two integers 2 and 5 is 10 since 10 is the smallest positive numbers which is divisible by both 2 and 5.

    1. Report
  8. Question:Definition of HCF (Highest common factor): 

    Answer
    HFC is also called greatest common divisor (gcd). HCF of two numbers is a largest positive numbers which can divide both numbers without any remainder.  For example HCF of two numbers 4 and 8 is 2 since 2 is the largest positive number which can dived 4 as well as 8 without a remainder.

    1. Report
  9. Question:C program to find whether a number is palindrome or not 

    Answer
    #include<stdio.h>
    int main(){
        int num,r,sum=0,temp;
    
        printf("Enter a number: ");
        scanf("%d",&num);
    
        temp=num;
        while(num){
             r=num%10;
             num=num/10;
             sum=sum*10+r;
        }
        if(temp==sum)
             printf("%d is a palindrome",temp);
        else
             printf("%d is not a palindrome",temp);
    
        return 0;
    }
    Sample output: Enter a number: 131 131 is a palindrome

    1. Report
  10. Question:Write a c program for palindrome within a range. 

    Answer
    #include<stdio.h>
    int main(){
        int num,r,sum,temp;
        int min,max;
    
        printf("Enter the minimum range: ");
        scanf("%d",&min);
    
        printf("Enter the maximum range: ");
        scanf("%d",&max);
    
        printf("Palindrome numbers in given range are: ");
        for(num=min;num<=max;num++){
             temp=num;
             sum=0;
    
             while(temp){
                 r=temp%10;
                 temp=temp/10;
                 sum=sum*10+r;
             }
             if(num==sum)
                 printf("%d ",num);
        }
        return 0;
    }
    Sample output: Enter the minimum range: 1 Enter the maximum range: 50 Palindrome numbers in given range are: 1 2 3 4 5 6 7 8 9 11 22 33 44

    1. Report
Copyright © 2024. Powered by Intellect Software Ltd