0 / 0 / 0
Регистрация: 17.09.2011
Сообщений: 55
1

Number of days in a year

22.09.2011, 15:48. Показов 2305. Ответов 2
Метки нет (Все метки)

Given a year number. Output the number of days of that year.
Example:
Input:
1900

Output
365

Example:
Input:
2012

Output
366
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
22.09.2011, 15:48
Ответы с готовыми решениями:

Given a year number. Output the number of days of that year
Помогите решить! Given a year number. Output the number of days of that year. Example: Input:...

Number of days in a year
Given a year number. Output the number of days of that year. Example: Input: 1900 Output...

Int number = 2; Console.WriteLine(++number - number-- * ++number); Выводит -6; Как ?
Знающие, объясните, пожалуйста. Каким чудом тут получается -6 ? O_o int number = 2; ...

Fatal error - Invalid parameter number: number of bound variables does not match number of tokens'
$pass = md5($_POST); $email = $_POST; $login = $_POST; $sex = $_POST;...

2
237 / 210 / 29
Регистрация: 08.06.2011
Сообщений: 467
22.09.2011, 15:58 2
C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
 
int num_of_days(int);
 
int main()
{
    int year = 0;
 
    for (;;) {
        printf("enter a year or 0 to exit: ");
        scanf("%d", &year);
        if (!year)
            break;
        printf("%d\n", num_of_days(year));
    }
    return 0;
}
 
int num_of_days(int year)
{
    int leap;
 
    leap = year%4 == 0 && year%100 != 0 || year%400 == 0;
    return (leap) ? 366 : 365;
}
1
Эксперт С++
7175 / 3234 / 81
Регистрация: 17.06.2009
Сообщений: 14,164
22.09.2011, 18:39 3
Неплохо бы скобки расставлять
C
1
int leap = (year%4 == 0) && ( (year%100 != 0) || (year%400 == 0) );
0
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
22.09.2011, 18:39
Помогаю со студенческими работами здесь

Invalid parameter number: number of bound variables does not match number of tokens
запрос $conn = connect_to_db(); $stmt = $conn-&gt;prepare(&quot;INSERT INTO brandaccounts...

Invalid parameter number: number of bound variables does not match number of tokens
Не могу решить ошибку: Invalid parameter number: number of bound variables does not match number...

Что значит эта строка return number == 1 ? 1 : (Foo(number - 1) + Foo(number - 2); ?
return number == 1 ? 1 : (Foo(number - 1) + Foo(number - 2));

Вывести "Leap Year", если заданный год високосный и "Normal Year" в противном случае
2.На вход программы подается год. Надо вывести слова Leap Year, если этот год високосный и Normal...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2023, CyberForum.ru