У нас вы можете посмотреть бесплатно Lecture 15 | Armstrong Number in C normal Program | Using While Loop | Vikas Singh или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Lecture 15 | Armstrong Number in C normal Program | Using While Loop | Vikas Singh
An Armstrong number (also known as a narcissistic number or pluperfect digital invariant) is a number that is equal to the sum of its own digits raised to the power of the number of digits. Here's a description of an Armstrong number checking program in C using a while loop:
int main() {
int num, originalNum, remainder, result = 0, n = 0;
// Input a number from the user
printf("Enter an integer: ");
scanf("%d", &num);
originalNum = num;
// Count the number of digits in the number
while (originalNum != 0) {
originalNum /= 10;
++n;
}
originalNum = num;
// Calculate the Armstrong number
while (originalNum != 0) {
remainder = originalNum % 10;
result += pow(remainder, n);
originalNum /= 10;
}
// Check if the number is an Armstrong number
if (result == num)
printf("%d is an Armstrong number.
");
else
printf("%d is not an Armstrong number.
");
return 0;
}
In this program:
The user is prompted to enter an integer.
The program counts the number of digits in the entered number using a while loop.
It then calculates the sum of each digit raised to the power of the number of digits and checks if this sum is equal to the original number to determine whether it's an Armstrong number.
The result is printed as either "is an Armstrong number" or "is not an Armstrong number."
#CProgramming
#WhileLoop
#ArmstrongNumber
#ProgrammingInC
#CodeSnippet
#ComputerScience
#CodingChallenge
#NumericalProgramming
#Algorithm
#TechSolutions