C Program to check whether a Date is Valid or not2 min read

In this tutorial, we will write a C program to check date is valid or not. Given the date, month and year, the program finds whether it is valid or not. Although before jumping to the main program, you should have knowledge of the following topics in C programming.

The valid Range for a date, month, and year is 1/1/1800 – 31/12/9999.

Explanation- What does the following program check for:

  • For Date: The date cannot be less than 1 and more than 31.
  • For Month: Month cannot be less than 1 and more than 12
  • For year: The maximum and minimum year is taken before the main program that is less than 1800 and more than 9999.
  • Leap Year: Checks if the year is a leap year or not.
    • If it is a leap year, the February month will have 29 days.
    • If it is not a leap year, the February month will have 28 days.
  • For 30 days month: The months April, June, September, and November cannot have more than 30 days

C Program Date is Valid or Not

Output:

Enter date (DD/MM/YYYY format): 13/06/1998
Date is valid.


MORE

Find the output ab, cd, ef, g for the input a,b,c,d,e,f,g in Javascript and Python

In this tutorial, we will write a program to find a pairs of elements from an array such that for the input [a,b,c,d,e,f,g] we will …
Read More

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …
Read More

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …
Read More

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …
Read More

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …
Read More

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …
Read More