Posts

Showing posts with the label Go program

Find number of days in a month in C | Cpp | Java | Go | php

C Program #include<stdio.h> int main() { int m,y; printf("Enter any month, say(1-12): "); scanf("%d",&m); switch(m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: printf("31 days"); break; case 4: case 6: case 9: case 11: printf("30 days"); break; case 2: printf("Enter the year: "); scanf("%d",&y); if(y%400 == 0 || y%100 != 0 && y%4 == 0) { printf("29 days"); } else { printf("28 days"); } break; default: printf("Invalid input"); } } C++ Program #include<iostream> using namespace std; int main() { int m,y; cout > m; switch(m) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: cout > y; if(y%400 == 0 || y%100 != 0 && y%4 == 0) { cout Java Program import java.util.Scanner; class MonthDays { public static void main(St...

Popular posts from this blog

Inline V/S Block Level Element

Variable Naming & Scope of Variable

Variables in Go lang

String in golang

Identifiers

Constant in Go lang

Decision Making in Go lang

Installing go lang

Identify Variable type and values in go lang

Sum of two numbers in go lang