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
- English Comprehension/Verbal Ability: Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions) Vocabulary Sentence Correction (Error Correction) Sentence Completion (Fill in the blanks) Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing) Subject Verb Agreement (Verb Noun Agreement) Tenses Verb Articles Preposition Conjunction Pronoun Noun Adjectives Adverb Modals Cloze Test (Cloze Passage) Active Passive Voice (Voice) Direct and Indirect Speech Sentence Construction
- Logical Ability: Coding Decoding Directions (Direction Test) Analogy Inequality Data Sufficiency Series (Number and Letter Series) (Numerical Relations and Reasoning) Syllogisms Seating Arrangements Puzzle Solving (Puzzles) Blood Relations Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning) Ranking, Order and Sequence Logical Sequence Of Words Data Arrangement Venn Diagram Calendar Clock
- Quantitative Ability: Logarithm Permutation and Combination Probability Profit and Loss Speed Time and Distance Mixture and Alligation Partnership Simple Interest and Compound Interest Percentage Ratio and Proportion (Ratios) Average Time and Work Pipe and Cistern Number System Divisibility Rules HCF LCM Algebra Powers and Exponents (Surds and Indices) Mensuration and Geometry Age Problems Data Interpretation Sequence and Series (Series)
- Basic Analytical Ability: Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning) Analytical Reasoning (Counting Figures Reasoning) Cubes & Dices Selection Decision Table (Decision Making)
- Computer Programming: Pseudo Codes Coding Questions by Yash Sir C Programming by Yash Sir Programming in C++ Java Python for Placements by Yash Sir
- DBMS (Computer Science): Basics of DBMS ER Diagram Relational Model & Functional Dependencies Keys & Integrity Constraints Normalization (1NF - BCNF) Transaction Management Concurrency Control Database Security & Authorization
- SQL (Computer Science): SQL
- OS (Computer Science): Introduction to OS Process Management CPU Scheduling Deadlock Process Synchronization Threads & Process Creation Memory Management Virtual Memory File Management
- Computer Networks (Computer Science): 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
- Data Structures (Computer Science): Introduction to DS Array Stack Queue Linked List Tree Graphs Hashing
- OOPs (Computer Science): Object Oriented Programming (OOPS)
- Software Engineering (Computer Science): Fundamentals of Software Engineering Software Requirements and Quality Assurance Software Design, Estimation and Metrics Software Testing Software Maintenance and Configuration Management
- SVAR Conversational - Spoken English: Communication Assessment
- HR Interview: MR & HR Interview Preparation
- Coding Practice Questions: Coding Questions Bank
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.

