Computer Programming C Laboratory: Practical C Programs

Write a C program to find whether the given number is armstrong or not

C Program with Algorithm, Flowchart, Output

Simple C Program with Algorithm, Flowchart, Output - Computer Programming - C

Write a C program to find whether the given number is armstrong or not.


AIM

To write a program in C to find the number is Armstrong or not.

The sum of the each digit cubic value of a number is equal to its original number = 153 called Armstrong. Eg: 153 = 13+53+33 = 153


ALGORITHM

Step-1 : Start

Step-2 : Read the value to the a

Step-3 : Assign value a to the variable e

Step-4 : Check whether the value of a is greather than zero or not

Step-5 : If step‒4 is True, do step‒6 to step‒10

Step-6 : Compute b = a%10

Step-7 : Compute c = b*b*b

Step-8 : Compute a = a/10

Step-9 : Compute d=c+d

Step-10 : goto step‒4

Step-11: If step‒4 is False, do the following steps.

Step-12: Check the value of e is equal to value of d

Step-13: If step‒12 is True, Print Armstrong

Step‒14: If step‒12 is False, Print Not Armstrong

Step‒15: Stop


FLOWCHART



PROGRAM

#include<stdio.h>

#include<conio.h>

void main()

{

int a,b,c,d,e;

printf("Enter the number :");

scanf("%d",&a);

e=a;

while(a>0)

{

      b=a%10;

      c=b*b*b;

      a=a/10;

      d=c+d;

}

if(e==d)

      printf("%d is an armstrong number. ",e);

else

      printf("%d is not an armstrong number. ",e);

}


OUTPUT

Enter the number : 153

153 is an armstrong number.

Enter the number : 123

123 is not an armstrong number

 

Computer Programming C Laboratory: Practical C Programs : Tag: C Programming : C Program with Algorithm, Flowchart, Output - Write a C program to find whether the given number is armstrong or not


Computer Programming C Laboratory: Practical C Programs



Under Subject


Computer Programming C

CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation



Related Subjects


English Essentials I

EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


தமிழர் மரபு - Heritage of Tamils

UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Calculus

MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I

PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Chemistry I

CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Makerspace

ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming C

CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming Python

CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Fundamentals of Electrical and Electronics Engineering

EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Mechanical Engineering

ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Civil Engineering

CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing

CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I Laboratory

PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Applied Chemistry I Laboratory

CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming Python Laboratory

CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Engineering Drawing

ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electronics and Electrical Engineering

EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing - Laboratory

CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation