Anna University Regulation 2013 Information Technology (IT) IT6212 PDS 1 LAB Manual for all experiments is provided below. Download link for IT 2nd SEM IT6212 Programming & Data Structures 1 Laboratory Manual is listed down for students to make perfect utilization and score maximum marks with our study materials.

Anna University Regulation 2013 Information Technology (IT) 2nd SEM IT6212 PDS 1 LAB-Programming & Data Structures 1 Laboratory Manual

ARMSTRONG NUMBER

Aim:

To write a C program for finding whether a given number is Armstrong number or not using loop control statements.

Algorithm:

1. Start the program.

2. Take number input from user store it in ‘number’.

3. Store that number into ‘temp’ temp:=number;

4. while temp!=0 do,

remainder:=temp%10;

sum:=sum+remainder*remainder*remainder;

temp:=temp/10;

End while

5. if number==sum then, print number is armstrong else print number is not armstrong

6. Stop the program

Program:

/*Armstrong Number*/

#include int main()

{

int n, n1, rem, num=0;

printf(“Enter a positive integer: “);

scanf(“%d”, &n); n1=n; while(n1!=0)

{

rem=n1%10; num+=rem*rem*rem; n1/=10;

}

if(num==n)

printf(“%d is an Armstrong number.”,n);

else printf(“%d is not an Armstrong number.”,n);

}

Output:

Enter a positive integer: 371 371 is an Armstrong number.

If you require any other notes/study materials, you can comment in the below section.

Search Terms

Anna University 2nd SEM IT PDS 1 LAB Manual