Find maximum of 3 numbers

Duration: 3 min

This video lesson is available to enrolled students.

Enroll to watch — LTI MINDTREE Superset Course

AI summary & chapters

AI Summary

An AI-generated summary of this video lecture.

This video is a programming tutorial from Knowledge Gate Eduventures, focusing on solving the problem of finding the greatest of three numbers using C programming. The instructor first presents the problem statement, which includes input and output specifications and a public test case with inputs 12, 8, 47 and expected output 47. The core of the lesson is a step-by-step walkthrough of a C code solution. The code, displayed on a digital blackboard, uses the `#include <stdio.h>` header and a `main()` function. It declares three integer variables `a`, `b`, and `c`, and a variable `max` to store the result. The program reads the three numbers using `scanf`. The logic to find the maximum is implemented with a series of `if-else` statements: it first compares `a` and `b` to determine the larger of the two, storing the result in `max`. It then compares this `max` value with `c` to find the overall greatest number. Finally, the program prints the value of `max`. The instructor uses the blackboard to illustrate the logic flow, writing out the variables and the step-by-step comparison process, including a hand-drawn example with the values 10, 12, and 14 to demonstrate how the logic works.

Chapters

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

    The video begins with the 'KNOX MEEHEGATF' logo, which is a stylized version of 'KNOWLEDGE GATE'. It then transitions to a slide showing the 'KNOWLEDGE GATE' brand and its social media handles for various educational streams like 'KG GATE & PLACEMENT PREP', 'KG CODING', and 'KG UGC NET COLLEGE PREP'. The main content starts with a problem statement for 'Q7: Find out greatest of 3 numbers (3 numbers are not equal)'. The problem specifies the input format as three integers separated by space and the output as the greatest number. A public test case is provided: Input: 12 8 47, Output: 47. The instructor, Yash Jain Sir, is visible in a small window, and the video is marked as proprietary content of KNOWLEDGE GATE EDUVENTURES.

  2. 2:00 2:45 02:00-02:45

    The video displays a C code solution on a digital blackboard. The code begins with `#include <stdio.h>` and defines the `main()` function. Inside, it declares variables `int a, b, c, max;`. The `scanf("%d %d %d", &a, &b, &c);` function reads the three integers. The logic to find the maximum is implemented with `if (a > b)` to compare the first two numbers, setting `max = a` if true, otherwise `max = b`. Then, `if (c > max)` compares the third number with the current maximum, updating `max = c` if true. Finally, `printf("%d", max);` prints the result. The instructor uses the blackboard to draw the logic flow, writing 'a b c' and demonstrating the comparison process with the values 10, 12, 14, showing how `max` is updated step-by-step.

The video provides a clear, structured tutorial on a fundamental programming problem. It follows a logical progression from problem definition to implementation. The instructor first establishes the problem's requirements, then presents a complete C program. The core of the lesson is the explanation of the algorithm, which uses sequential conditional checks to find the maximum value. The visual aid of the digital blackboard, with handwritten annotations and a step-by-step walkthrough of the logic, effectively reinforces the concept of using `if-else` statements to compare multiple values, making the solution easy to understand and replicate.

Loading lesson…