Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include <iostream>
- #include <Windows.h>
- void InputDate(int &N) {
- while (N > 10000) {
- std::printf("Введите значение N (не более 10 000): ");
- std::cin >> N;
- }
- }
- void Calcul(int N) {
- int z = 0;
- int k = 0;
- int k_finish = 0;
- int array[5];
- while (z < 2498) {
- k = z + z + 1 + z + 2 + z + 3;
- if (k == N) {
- array[0] = z;
- array[1] = z+1;
- array[2] = z+2;
- array[3] = z+3;
- k_finish = k;
- z = 2500;
- // std::printf("%d %d", k, k_finish);
- }
- z++;
- }
- if (k_finish == N) {
- std::printf("\nДа, значения найдены: %d, %d, %d, %d", array[0], array[1], array[2], array[3]);
- }
- else {
- std::printf("\nНет, значения не были найдены.");
- }
- }
- int main()
- {
- int N = 10001;
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- InputDate(N);
- Calcul(N);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement