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
- Communication Round: Vocabulary, Subject Verb Agreement (Verb Noun Agreement), Tenses, Comprehension / Reading Comprehension / Unseen Passages (Critical Reasoning) (Paragraph Questions), Cloze Test (Cloze Passage), Sentence Correction (Error Correction), Sentence Completion (Fill in the blanks), Sentence Re-arrangements (Para Jumbles) (Narrative Sequencing), Direct and Indirect Speech, Active Passive Voice (Voice), Verbal Analogy (Word Based Analogy), Articles, Preposition, Conjunction, Sentence Construction, English Writing Ability, Communication Assessment
- Quantitative Aptitude: Ratio and Proportion (Ratios), Divisibility Rules, Data Interpretation, Mixture and Alligation, Permutation and Combination, Logarithm, Number System, HCF LCM, Speed Time and Distance, Percentage, Average, Powers and Exponents (Surds and Indices), Time and Work, Mensuration and Geometry, Age Problems, Pipe and Cistern, Probability, Profit and Loss, Simple Interest and Compound Interest, Algebra
- Analytical and Logical Reasoning: Series (Number and Letter Series) (Numerical Relations and Reasoning), Coding Decoding, Data Sufficiency, Non Verbal Reasoning (Spatial Aptitude) (Spatial Reasoning) (Visual Reasoning), Directions (Direction Test), Ranking, Order and Sequence, Deductive and Inductive Reasoning (Logical Deduction and Induction) (Prepositional Reasoning), Selection Decision Table (Decision Making), Logical Sequence Of Words, Puzzle Solving (Puzzles), Syllogisms, Seating Arrangements, Calendar, Clock, Blood Relations, Cubes & Dices, Venn Diagram, Analytical Reasoning (Counting Figures Reasoning)
- Cognizant Gaming Aptitude: Gamified / Game Based Aptitude
- Java (Cluster 1): Java
- ANSI SQL MySQL (Cluster 1,2,3): SQL
- HTML, CSS, JavaScript (Cluster 1,3): HTML, CSS, JavaScript
- Python (Cluster 2): Python for Placements by Yash Sir
- Cloud Fundamentals (Cluster 2): Emerging Tech Trends
- C# (Cluster 3): C#
- OOPs: Object Oriented Programming (OOPS)
- Technical Assessment (Coding): Coding Questions by Yash Sir, C Programming by Yash Sir, Programming in C++, Pseudo Codes
- Data Structures: Introduction to DS, Array, Stack, Queue, Linked List, Tree, Graphs, Hashing
- DBMS: 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, ORDBMS, Database Security & Authorization, Query Processing & Optimization, Enhanced Data Models, Data Warehousing & Mining, Big Data Systems, NoSQL
- Operating Systems: Introduction to OS, Process Management, CPU Scheduling, Process Synchronization, Deadlock, Threads & Process Creation, Memory Management, Virtual Memory, Disc Scheduling, File Management, Windows OS, Linux OS, Security, Distributed Systems, Virtual Machines
- Computer Networks: 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, Mobile Technology, Cloud Computing and IoT, Cyber and Info Security
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.