Find minimum of 4 numbers

Duration: 3 min

This video lesson is available to enrolled students.

Return to /learn/TCS-NQT-PREPARATION/advanced-coding/coding-questions/coding-question/asset-find-minimum-of-4-numbers after enrolling

Inside: a video lesson and guided study material.

Module outline

  1. TCS One Shot Free Videos & Notes: TCS Preparation
  2. Numerical Ability (Foundation Section): Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Sequence and Series (Series), Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Algebra, Probability, Profit and Loss, Simple Interest and Compound Interest, Time and Work, Pipe and Cistern, Mensuration and Geometry, Mental Ability, Age Problems, Statistics, Arithmetic, Partnership, Speed Mathematics and Basic Mathematics
  3. Reasoning Ability (Foundation Section): Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Syllogisms, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Seating Arrangements, Blood Relations, Directions (Direction Test), Analytical Reasoning (Counting Figures Reasoning), Puzzle Solving (Puzzles), Calendar, Clock, Cubes & Dices, Selection Decision Table (Decision Making), Crypt Arithmetic, Venn Diagram, Data Arrangement, Inequality, Analogy, Ranking, Order and Sequence, Logical Sequence Of Words
  4. New Pattern-Verbal Ability (Foundation Section): Sentence Completion (Fill in the blanks), English Writing Ability
  5. Old Pattern-Verbal Ability (Foundation Section): Vocabulary, Noun, Subject Verb Agreement (Verb Noun Agreement), Adjectives, Tenses, Pronoun, Preposition, Articles, Direct and Indirect Speech, Conjunction, Modals, Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Sentence Correction (Error Correction), Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Verbal Analogy (Word Based Analogy), Active Passive Voice (Voice), Determiner, Facts, Inference and Judgements, Adverb, Cloze Test (Cloze Passage), Sentence Construction, Verb
  6. Advanced Quantitative Ability: TCS NQT Advanced Quantitative Ability
  7. Advanced Reasoning Ability: TCS NQT Advanced Reasoning Ability
  8. Advanced Coding: Coding Questions by Yash Sir, C Programming by Yash Sir, Python for Placements by Yash Sir, DSA using Python, Object Oriented Programming (OOPS), Programming in C++, Java
  9. TCS Full Length Mock Test:
  10. TCS Interview & Resume Prep: MR & HR Interview Preparation, TCS Interview Preparation, Mock Interview, Interview Recordings, Resume Preparation, Resume Review
  11. Mega Test:
  12. Grand Test:
AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

The video is a programming tutorial from Knowledge Gate, focusing on solving a problem to find the smallest of four given integers. The instructor first presents the problem statement, Q8, which requires reading four integers and outputting the smallest one. The solution is then implemented in C using a step-by-step comparison approach. The code uses a variable 'min' initialized with the first number, then compares it with the other three numbers sequentially using if-else statements to update the minimum value. The instructor demonstrates the logic by hand-writing the comparison process on the screen, using the numbers 3, 5, 4, and 2 as an example, showing how the variable 'min' is updated from 3 to 2. Finally, the code is executed in an online C++ compiler, where the input 1 2 3 4 is provided, and the output 1 is correctly displayed, confirming the program's functionality.

Chapters

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

    The video begins with the Knowledge Gate logo and a diagram of their social media channels. The main content starts with a problem statement, Q8, displayed on a digital blackboard: 'Find out smallest of 4 numbers (numbers are not equal)'. The input is defined as four integers separated by space, and the output is the smallest number. The instructor, Yash Jain Sir, introduces the problem and then transitions to the code implementation. The C code is shown on the screen, starting with '#include <stdio.h>' and 'int main()'. The code declares four integer variables 'a, b, c, d' and a 'min' variable. It uses 'scanf' to read the four numbers. The core logic is a series of if-else statements: first, it compares 'a' and 'b', setting 'min' to the smaller of the two. Then, it compares 'min' with 'c', updating 'min' if 'c' is smaller. Finally, it compares 'min' with 'd', updating 'min' if 'd' is smaller. The result is printed using 'printf'. The instructor explains this logic, and on the screen, he hand-writes the comparison process for the numbers 3, 5, 4, and 2, showing how 'min' is updated from 3 to 2.

  2. 2:00 – 2:30 02:00-02:30

    The video transitions to a live demonstration of the code in an online C++ compiler, the OnlineGDB. The instructor shows the same C code from the previous segment. He then navigates to the 'Input' section at the bottom of the screen and types the numbers '1 2 3 4' as the test case. After clicking the 'Run' button, the compiler executes the program. The output section displays '1', which is the correct smallest number from the input, confirming the code works as intended. The instructor observes the result, and the video ends with the successful execution of the program.

The video provides a complete, step-by-step tutorial on solving a fundamental programming problem. It starts with a clear problem definition, moves to a logical algorithmic solution using sequential comparisons, and concludes with a practical demonstration of the code's execution. The progression from theory to practice effectively teaches the core concept of finding a minimum value in a set of numbers using conditional statements in C.

Loading lesson…