Find number of days in the month from a given date
Duration: 6 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 calculate the number of days in a given month from a user-provided date. The instructor begins by presenting the problem statement, which involves parsing a date in the format dd-mm-yyyy and finding the number of days in that month, with the simplification of ignoring leap years. The core of the lesson is a step-by-step walkthrough of a C code solution. The code uses an array to store the number of days for each month (January to December), with the value for February set to 28. The program prompts the user to enter a date, reads the input, and then uses the `strtok` function to split the date string by the hyphen delimiter. The month part is extracted, converted from a string to an integer using `atoi`, and used as an index to access the corresponding number of days from the array. The solution is then demonstrated in an online C compiler, where the user inputs a date, and the program correctly outputs the number of days in that month. The video is part of a series from 'Knowledge Gate' and is presented by an instructor named Yash Jain, who is visible in a small window throughout the lecture.
Chapters
0:00 – 2:00 00:00-02:00
The video starts with the 'Knowledge Gate' logo, followed by a slide that introduces the channel's various social media handles and educational offerings like 'KG GATE & PLACEMENT PREP' and 'KG CODING'. The main content begins with a presentation slide that clearly states the problem: 'Q10: User enters date in dd-mm-yyyy find out number of days in month (for now please ignore the concept of leap year)'. The slide provides the input and output format and includes public test cases, such as 'Input: 12-03-2006' with 'Output: 31'. The instructor, Yash Jain, is visible in a small window, and the video is presented as a lecture from 'Knowledge Gate Edventures'.
2:00 – 5:00 02:00-05:00
The instructor displays a C code solution on a digital blackboard. The code begins with standard includes: `#include <stdio.h>`, `#include <string.h>`. The main function is defined, and an integer array `arr` is initialized with the number of days for each month, starting with 31 for January and ending with 31 for December, with February set to 28. The code prompts the user to 'Enter date'. It declares a character array `date[11]` to store the input and a pointer `token` for string parsing. The `scanf` function reads the date string. The instructor then explains the use of `strtok` to split the date string by the hyphen delimiter. The month part is extracted, converted to an integer using `atoi`, and used to index the `arr` array to get the number of days. The final output is printed using `printf("Month has %d days", arr[i-1]);`. The instructor uses a whiteboard to draw arrows and write notes like 'dd-mm-yyyy' and 'token' to explain the logic.
5:00 – 5:42 05:00-05:42
The video transitions to a screen recording of the 'GDB Online' compiler. The instructor pastes the C code into the editor. The code is successfully compiled, as indicated by the 'Compiled Successfully' message. The instructor then runs the program, and the 'Input' field appears. He types '12-03-2006' and presses enter. The program executes and correctly outputs 'Month has 31 days', demonstrating that the solution works for the given test case. The instructor confirms the result, concluding the practical demonstration of the code.
The video provides a comprehensive, step-by-step tutorial on solving a common programming problem. It begins with a clear problem definition, followed by a detailed explanation of the algorithm, which relies on a pre-defined array of month days and string parsing functions. The instructor methodically walks through the code, explaining each line and the logic behind it. The lesson is effectively concluded with a live demonstration in an online compiler, which validates the solution's correctness. This approach, combining theory, code walkthrough, and practical execution, makes the content highly educational for students learning C programming.

