Check whether a number is armstrong by calculation order
Duration: 7 min
This video lesson is available to enrolled students.
Inside: a video lesson and guided study material.
Module outline
- Quantitative Ability: Speed Mathematics and Basic Mathematics, Percentage, Ratio and Proportion (Ratios), Average, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Speed Time and Distance, Number System, HCF LCM, Data Interpretation, Age Problems, Mixture and Alligation, Partnership, Algebra, Sequence and Series (Series), Mensuration and Geometry, Arithmetic
- Reasoning Ability: Puzzle Solving (Puzzles), Seating Arrangements, Coding Decoding, Blood Relations, Directions (Direction Test), Syllogisms, Data Sufficiency, Ranking, Order and Sequence, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Calendar, Clock, Cubes & Dices, Analytical Reasoning (Counting Figures Reasoning), Data Arrangement, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning)
- Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Vocabulary, Sentence Completion (Fill in the blanks), Active Passive Voice (Voice), Direct and Indirect Speech, Subject Verb Agreement (Verb Noun Agreement), Tenses, Preposition, Articles, Sentence Correction (Error Correction)
- Programming Basics (MCQs + Interview): C Programming by Yash Sir, Programming in C++, Java, Python for Placements by Yash Sir
- OOPs (MCQs + Interview): Object Oriented Programming (OOPS)
- DBMS (MCQs + Interview): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Transaction Management, Decomposition Properties & 4NF, Concurrency Control, Database Recovery, File Organization & Indexing, Relational Algebra, Database Security & Authorization
- SQL (MCQs + Interview): SQL
- Operating Systems (MCQs + Interview): Introduction to OS, Process Management, CPU Scheduling, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Process Synchronization, Disc Scheduling, File Management, Security
- Computer Networks (MCQs + Interview): Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Data Link Layer - Ethernet, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security, Cloud Computing and IoT, Cyber and Info Security
- Coding: Coding Questions by Yash Sir
- HR Interview: MR & HR Interview Preparation
AI summary & chapters
AI Summary
An AI-generated summary of this video lecture.
This video is a programming tutorial that teaches how to write a C program to check if a number is an Armstrong number. The instructor begins by introducing the concept of an Armstrong number, which is a number that is equal to the sum of its own digits each raised to the power of the number of digits. The lesson is structured around a step-by-step implementation. First, a function named `order` is defined to calculate the number of digits in a given number using a loop that repeatedly divides the number by 10. This function is then used in the main `isArmstrong` function. The `isArmstrong` function extracts each digit of the number, raises it to the power of the total number of digits (using the `pow` function), and accumulates the sum. Finally, the program compares this sum to the original number to determine if it is an Armstrong number. The tutorial includes a worked example using the number 153, which is confirmed to be an Armstrong number because 1^3 + 5^3 + 3^3 = 153. The video concludes with a demonstration of the complete code running in an online C compiler, showing the program's output.
Chapters
0:00 – 2:00 00:00-02:00
The video starts with the 'KNOX MEEHEGATF' logo, which is a stylized version of 'KNOWLEDGE GATE'. It then transitions to a screen showing the 'KNOWLEDGE GATE' brand and its social media handles. The main content begins with a C code snippet on a digital blackboard. The instructor introduces a function `int order(int x)` designed to calculate the number of digits in a number. The function initializes a counter `n` to 0 and uses a `while` loop that continues as long as `x` is greater than 0. Inside the loop, the counter `n` is incremented, and `x` is divided by 10. The loop terminates when `x` becomes 0, and the function returns the final count `n`. The instructor explains this logic, and on-screen text shows the code and a handwritten example `x=153` to illustrate the process.
2:00 – 5:00 02:00-05:00
The instructor continues to explain the `order` function, using the example `x=153`. He demonstrates the loop iteration by hand, showing that `n` starts at 0 and is incremented three times (n=1, n=2, n=3) as `x` is divided by 10 (153 -> 15 -> 1 -> 0). He confirms that the function correctly returns 3, which is the number of digits. The video then transitions to the main function, `int isArmstrong(int x)`. The instructor explains that this function will use the `order` function to get the number of digits `n`. He initializes a temporary variable `temp` to the input number `x` and a `sum` variable to 0. A `while` loop is used to process each digit of `temp`. Inside the loop, the last digit is extracted using `temp % 10`, and this digit is raised to the power of `n` using the `pow` function and added to the `sum`. The `temp` variable is then updated by integer division by 10. The instructor writes the formula `153 = 1^3 + 5^3 + 3^3` to illustrate the Armstrong condition.
5:00 – 7:19 05:00-07:19
The instructor completes the `isArmstrong` function by adding the final condition. After the loop, the function checks if the calculated `sum` is equal to the original number `x`. If true, it returns 1 (true); otherwise, it returns 0 (false). The video then shows the complete `main` function, which takes user input for a number `x`, calls `isArmstrong(x)`, and prints "True" or "False" based on the result. The final segment demonstrates the code running in the GDB Online compiler. The instructor runs the program with the input 153, and the output is "True", confirming that 153 is an Armstrong number. The video concludes with the program finishing with exit code 0.
The video provides a comprehensive, step-by-step guide to solving the Armstrong number problem in C. It begins with a foundational function to calculate the number of digits, which is a crucial step. This function is then integrated into the main logic, which iteratively processes each digit, applies the power operation, and accumulates the sum. The lesson effectively uses a concrete example (153) to illustrate the mathematical concept and the code's logic. The progression from function definition to the final main program, culminating in a live code execution, creates a clear and practical learning experience for students.

