Convert Decimal to Octal

Duration: 3 min

This video lesson is available to enrolled students.

Return to /learn/CAPGEMINI-PREPARATION/pseudo-code/coding-questions/coding-question/asset-convert-decimal-to-octal after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. English Communication: Communication Assessment, English Writing Ability, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions)
  2. Artificial Intelligence (AI Literacy): AI & ML by Arun Sir
  3. Programming, Logic & Problem Solving (Technical Assessment): Language Design, Pseudo Codes
  4. DSA (Technical Assessment): Introduction to DS, Array, Stack, Queue, Linked List
  5. Software Engineering (Technical Assessment): Fundamentals of Software Engineering, Software Requirements and Quality Assurance, Software Design, Estimation and Metrics, Software Testing, Software Maintenance and Configuration Management
  6. OOPs (Technical Assessment): Object Oriented Programming (OOPS)
  7. DBMS (Technical Assessment): Basics of DBMS, ER Diagram, Relational Model & Functional Dependencies, Keys & Integrity Constraints, Normalization (1NF - BCNF), Decomposition Properties & 4NF, File Organization & Indexing, Relational Algebra, Relational Calculus, Transaction Management, Concurrency Control, Database Recovery, Database Security & Authorization, Data Warehousing & Mining, NoSQL
  8. SQL (Technical Assessment): SQL
  9. Networking (Technical Assessment): Introduction to CN, Data Communication, DLL: Access Control, DLL: Flow Control, DLL: Error Control, DLL: Framing, Net Layer: IPv4 & Proto, Net Layer: IP Addressing, Net Layer:Routing Protocol, Transport Layer Services, TL: Congestion & UDP, Application Layer, Hardware basics, Network Security
  10. Modern Engg Awareness (Technical Assessment): Emerging Tech Trends, Cyber and Info Security
  11. Debugging Assessment: Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Java
  12. Cognitive Assessment: Gamified / Game Based Aptitude, Seating Arrangements, Puzzle Solving (Puzzles), Data Arrangement, Blood Relations, Directions (Direction Test), Coding Decoding, Series (Number and Letter Series) (Numerical Relations and Reasoning), Logical Sequence Of Words, Ranking, Order and Sequence, Data Sufficiency, Inequality, Venn Diagram, Syllogisms, Cubes & Dices, Calendar, Clock, Analytical Reasoning (Counting Figures Reasoning), Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Selection Decision Table (Decision Making), Behavioral Assessment (Behavioral Competency Profiling) (Psychometric Test)
  13. 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 from Knowledge Gate that teaches how to convert a decimal number to an octal number. The lesson begins with an introduction to the problem, which is to write a C program to convert a decimal number to octal. The instructor first explains the manual conversion process using the division-by-8 method, demonstrating it with the decimal number 33, which results in the octal number 41. The video then transitions to the coding part, where the instructor displays a C program. The code uses a loop to repeatedly divide the input number by 8, collecting the remainders to form the octal number. The instructor walks through the code, explaining the logic and variables, and demonstrates the step-by-step calculation of the octal equivalent of 33, showing how the final result is built digit by digit.

Chapters

  1. 0:00 – 2:00 00:00-02:00

    The video starts with the Knowledge Gate logo, followed by a slide showing the company's various educational offerings. The main content begins with a PowerPoint presentation titled 'Q2: Write a program to convert Decimal to Octal'. The instructor, identified as a 'Placement Expert', introduces the topic. The screen then displays a diagram under the heading 'Logic' that illustrates the manual conversion of the decimal number 33 to octal. The process involves dividing 33 by 8, which gives a quotient of 4 and a remainder of 1. Then, 4 is divided by 8, giving a quotient of 0 and a remainder of 4. The remainders are read in reverse order to get the octal number 41. The instructor explains this logic, emphasizing the division-by-8 method.

  2. 2:00 – 2:41 02:00-02:41

    The video transitions to the 'Code' section, where a C program is displayed on the screen. The code includes the standard header file, a main function, and variables for the input number (n), a temporary variable (dn), a variable to store the octal result (binno), and loop counters (i, j). The program uses a for loop to repeatedly divide the number by 8. The instructor explains the logic, noting that the remainder of each division (n%8) is added to the result (binno) after being multiplied by a power of 10 (i). The variable 'i' is multiplied by 10 in each iteration to shift the place value. The instructor demonstrates the calculation step-by-step, showing that for n=33, the first iteration gives a remainder of 1, which is added to binno (0 + 1*1 = 1). The second iteration gives a remainder of 4, which is added to binno (1 + 4*10 = 41). The final printf statement outputs the result, confirming the octal of 33 is 41.

The video provides a comprehensive, step-by-step tutorial on converting a decimal number to octal, covering both the theoretical logic and its practical implementation in C. It begins with a clear explanation of the manual division method, using a worked example to build understanding. This foundational knowledge is then directly applied to the programming solution. The instructor bridges the gap between the algorithm and the code by walking through the C program, explaining each line and variable, and demonstrating the calculation process. This approach ensures that students not only learn the code but also understand the underlying mathematical principle, making the lesson effective for both beginners and those looking to solidify their programming fundamentals.

Loading lesson…