Skip to content

Instantly share code, notes, and snippets.

@prodevo
Created May 18, 2025 19:45
Show Gist options
  • Save prodevo/f18ceb99f9f882c5301c6dc9db3ed08d to your computer and use it in GitHub Desktop.
Save prodevo/f18ceb99f9f882c5301c6dc9db3ed08d to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
const float P = 3.1415;
int r;
cout << "vvedit radius: ";
cin >> r;
cout << "S = " << r * r * P;
cout << "\nl = " << 2 * r * P;
}
#include <iostream>
using namespace std;
int main()
{
int a = 1;
int b = 2;
int c = a;
a = b;
b = c;
}
int main1()
{
int a = 1;
int b = 2;
a = a + b;
b = a - b;
a = a - b;
}
#include <iostream>
using namespace std;
int main()
{
cout << "vvedit sumu(uah): ";
float s;
cin >> s;
int r = (s - int(s)) * 100 + 0.5;
cout << int(s) << " grn\t" << r << " kopijok";
}
#include <iostream>
using namespace std;
int main()
{
cout << "vvedit chas(sek): ";
int vvod;
cin >> vvod;
int d = vvod / 86400;
int h = (vvod % 86400) / 3600;
int m = (vvod % 3600) / 60;
int s = vvod % 60;
cout << d << " dniv, " << h << " hodyn, " << m << " hvylyn, " << s << " sekund";
}
#include <iostream>
using namespace std;
int main()
{
int a;
int b;
cout << "vvedit pershe trycyfrove chyslo: ";
cin >> a;
cout << "vvedit druge trycyfrove chyslo: ";
cin >> b;
int mid_a = int((a / 10) % 10 * 10);
int mid_b = int((b / 10) % 10 * 10);
a = a - int((a / 10) % 10 * 10) + mid_b;
b = b - int((b / 10) % 10 * 10) + mid_a;
cout << a << '\n';
cout << b;
}
#include <iostream>
using namespace std;
int main()
{
int n;
int m;
int x;
int g;
cout << "k-ist kurok: ";
cin >> n;
cout << "cina kurky(grn): ";
cin >> m;
cout << "jajets z kurky na tyzhden: ";
cin >> x;
cout << "cina za 10 jajets(grn): ";
cin >> g;
int g_pdv = g - (g * 0.2);
int total_cost = n * m;
int per_day = (n * x / 7) * (g_pdv / 10);
int to_payoff = (total_cost / per_day) + 0.51;
cout << "okupnist: " << to_payoff << " dniv";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment