Календарь
« Июнь 2025 » |
Пн |
Вт |
Ср |
Чт |
Пт |
Сб |
Вс |
| | | | | | 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 | 26 | 27 | 28 | 29 | 30 |
|
Главная » C (задачи)
Write a program that inputs a series of integers and passes them one at a time to function isEven, which uses the remainder operator to determine whether an integer is even. The function should take an integer argument and return 1 if the integer is even and 0 otherwise.
Напишите программу, которая вводит последовательность целых чисел и передает их по одному функции isEven, которая использует операцию деления по модулю, чтобы определить, является ли целое четным. Функция должна получать один аргумент и возвращать 1, если целое четно, и 0 в противном случае.
#include <stdio.h>
int isEven(int);
int main()
{
int number;
puts("Enter number:(Exit: 0)");
scanf("%d", &number);
while(number != 0)
{
if(isEven(number) == 1)
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
318
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a function isMultiple that determines for a pair of integers whether the second integer is a multiple of the first. The function should take two integer arguments and return 1 (true) if the second is a multiple of the first, and 0 (false) otherwise. Use this function in a program that inputs a series of pairs of integers.
Напишите функцию isMultiple для двух целых, которая передает, кратно ли второе число первому. Функция должна получать два целых аргумента и возвращать 1(true), если второе число кратно первому, и 0(false) в противном случае. Используйте эту функцию в программе, которая вводит серию пар целых чисел.
#include <stdio.h>
#include <stdbool.h>
bool isMultiple(int, int);
int main()
{
int integer1, integer2;
puts("Enter integer1(enter - 0)");
scanf("%d", &integer1);
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
306
|
Добавил:
alex
|
Дата:
23.06.2018
|
Write a function integerPower(base, exponent) that returns the value of baseexponent. For example, integerPower(3, 4) = 3 * 3 * 3 * 3. Assume that exponent is a positive, nonzero integer, and base is an integer. Function integerPower should use for to control the calculation. Do not use any math library functions.
Напишите функцию integerPower(base, exponent), которая возвращает значение baseexponent. Например, integerPower(3, 4) = 3 * 3 * 3 * 3. Предположим, что exponent является положительным ненулевым целым, а base целым. Для управления вычислением функция integerPower должна применять цикл for. Не используйте никаких функций математической библиотеки.
#include <stdio.h>
int integerPower(int, int);
int main()
{
int base, exponent;
puts("Enter base:"
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
199
|
Добавил:
alex
|
Дата:
23.06.2018
|
Define a function called hypotenuse that calculates the length of the hypotenuse of a right triangle when the other two sides are given. The function should take two arguments of type double and return the hypotenuse as a double.
Определите функцию hypotenuse, которая вычисляет длину гипотенузы прямоугольного треугольника по двум другим сторонам. Используйте эту функцию в программе для определения длины гипотенузы треугольников, приведенных ниже. Функция должна получать два аргумента типа double и возвращать значение гипотенузы также типа double.
...
Читать дальше »
Категория:
C (задачи)
|
Просмотров:
207
|
Добавил:
alex
|
Дата:
23.06.2018
| |
|