STUDENTS 3K

  • Home
  • Students+
    • Engineering Students
    • Education Loan
    • Study Abroad Guide
    • Projects Download
  • Freshers
    • Aptitude Q & A
    • Placement Papers
    • Verbal Ability
    • Interview Questions
    • IT Company Details
    • Job Updates
  • Study Resources
    • Career Guidance
    • LAB Programs
      • C Programs
      • CPP Programs [C++]
      • Java Programs
    • Question Papers
    • Learn English
    • Notice Board
  • More –>>
    • Love calculator
You are here: Home / Important Programs / C program to find Number is Armstrong or not

C program to find Number is Armstrong or not

C 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.

  • Fibonacci series upto ā€˜n’ numbers in C

FIND NUMBER IS ARMSTRONG OR NOT IN C

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.

[Read: Career Guidance for all] & [Aptitude Q&A free download]

C CODE:

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
	temp=number;

	//check number is Armstrong are not
	while(number>0) //Unconditional statement
	{
		number1=number%10;
		sum+=pow(number1,3);
		number/=10;
	}
	if(sum==temp) //Conditional ststement
		printf("Number is armstrong number");

	getch();
}

Filed Under: Important Programs Tagged With: C, LAB, Programs





Random Materials :

  • Data Mining and Data Warehousing
  • Difference Between Class and Primitive Types
  • Database Roles in SQL
  • CASE Expression in SQL
  • Concurrent Update Problem

Follow Us on Facebook

Advertisement

Company Profile

  • About Students3k
  • Contact Us
  • Earn Money Online
  • Website Archive Page
  • Privacy Policy
  • Disclaimer

Categories

  • Important Programs
  • Study Abroad
  • IT Companies
  • Career Guidance for Students
  • Teachers
  • Verbal Analogies

We Are Social

  • Facebook Fans
  • Twitter Follow
  • Google Plus
  • Pinterest Page

© Copyright 2012 - 2016 Students3k.com · All Rights Reserved · Designed By Benefits

Show