diff --git "a/Beginner Level \360\237\223\201/Number of days in a month/question.md" "b/Beginner Level \360\237\223\201/Number of days in a month/question.md" new file mode 100644 index 0000000..4b90fe8 --- /dev/null +++ "b/Beginner Level \360\237\223\201/Number of days in a month/question.md" @@ -0,0 +1,7 @@ +# Number of days in a month +
Q: Input the number of the month, calculate the number of days present in that particular month.
Note: Consider non-leap year.

 

+ Example 1:
Input: 10
Output: 31
Explaination: October has 31 days
+ Example 2:
Input: 2
Output: 28
Explaination: February has 28 days
+ Example 3:
Input: 11
Output: 30
Explaination: November has 30 days

+Contraints:
1 <= month <= 12 +
diff --git "a/Beginner Level \360\237\223\201/Number of days in a month/solution.java" "b/Beginner Level \360\237\223\201/Number of days in a month/solution.java" new file mode 100644 index 0000000..89f985d --- /dev/null +++ "b/Beginner Level \360\237\223\201/Number of days in a month/solution.java" @@ -0,0 +1,31 @@ + +//number of days in a month +import java.util.*; + +public class Main { + public static void main(String[] args){ + Scanner sc = new Scanner(System.in); + System.out.println("Enter a month number of your choice (between 1 to 12): "); + int m = sc.nextInt(); //here "m" refers to month + int n; // here "n" refers to number of days + if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12){ + n = 31; //jan, mar, may, july, aug, oct, dec + } + else if(m == 2) { + n = 28; //feb + } + else + n = 30; //rest months i.e apr, june, sep, nov + + System.out.println ("Number of days in this particular month: "); + System.out.println(n); + } +} + +/* +// Output: +Enter a month number of your choice (between 1 to 12): +3 +Number of days in this particular month: +31 +*/ diff --git "a/Beginner Level \360\237\223\201/data.json" "b/Beginner Level \360\237\223\201/data.json" index ef2f8bb..310103d 100644 --- "a/Beginner Level \360\237\223\201/data.json" +++ "b/Beginner Level \360\237\223\201/data.json" @@ -41,5 +41,9 @@ { "name": "Ghanshyam Saini", "githubUsername": "Ghanshyam07" + }, + { + "name": "Neyna Nayak", + "githubUsername":"neyhere07" } ]