Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab5 (108)

Snippet info

Language

Cpp

Visibility

public

Author

andrusus.korotkovus

Created

2018-10-30T06:46:14Z

Updated

2018-10-30T06:46:14Z

#include <iostream>
#include<cmath>

using namespace std;

int main() 
{
	setlocale(LC_ALL, "ru");
	int const SUMA = 100;
	int b, k, t;

	for (b = 0; b < SUMA / 10; b++)
	{
		for (k = 0; k < (SUMA - b * 10) / 5; k++)
		{
			t = round((SUMA - b * 10 - k * 5) / 0.5);

			if ((b * 10 + k * 5 + t * 0.5 == SUMA) && (b + k + t == 100))
			{
				cout << "Быков - " << b << endl
					<< "Коров - " << k << endl
					<< "Телят - " << t << endl;
			}

		}
	}
	
	
	return 0;
}
INFO