Практикум по программированию. Основы. Ветвление. Високосный год

From AsIsWiki
Revision as of 10:03, 12 April 2015 by Alex (Talk | contribs)

Jump to: navigation, search

Назад · Задачи · Дальше


Contents

Java

import java.util.Scanner;

public class Task16 {

    public static void main(String[] args) {
        
        Scanner in = new Scanner(System.in);
        
	System.out.println();
        System.out.println(" Проверка года на високосность ");
        System.out.println("-------------------------------");

        System.out.print(" Введите год (2012): "); 
	int g = in.nextInt();

        System.out.println("-------------------------------");
        
	System.out.print(" Год ");

	if ((g % 4 != 0) || ((g % 100 == 0) && (g % 400 != 0))) {

	    System.out.print("не ");

	}

	System.out.println("високосный");
    }
}


C++



Pascal




Назад · Задачи · Дальше

Personal tools
Namespaces

Variants
Actions
Navigation
Tools