Wednesday, 10 September 2014

Find Number is Armstrong or not in C Language With Example

C Language program to find Number is Armstrong or not. It is a simple source code that provides the output of an actual Armstrong number. Take care of a questions for your interviews or students exam. This is a totally free of cost code.

Find the given number is Armstrong or not program in C used to detect the input number is Armstrong or not by calculating and sum the individual cube value of each number. If it is same to the given number then it will display an output. For example, the given number is 153(13+53+33=153) then it will be an Armstrong number.

Q: Write a C program to check whether a given input value is Armstrong number or not.

//Header files
#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
    //Program variables
    int number,temp,number1,sum=0;
    clrscr();//Function to clear previous output
    printf("Enter number : "); //Display function
    scanf("%d",&number); //Getting input function
    //check number is Armstrong are not
    while(number>0//Unconditional statement
    if(sum==temp) //Conditional ststement
        printf("Number is armstrong number");

No comments:

Post a Comment

Note: only a member of this blog may post a comment.