0% found this document useful (0 votes)
4 views

New Text Document

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

New Text Document

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <iostream>

using namespace std;

int main()
{
int m, p = 0;
while (p == 0)
{
cout << " PROGRESIE ARITMETICA" << endl << endl;
cout << "0.....ghid" << endl;
cout << "1.....sunt A,B,C in progresie aritmetica?" << endl;
cout << "2.....suma primilor n termeni din progresie" << endl;
cout << "3.....al n-lea termen din progresie" << endl;
cout << "4.....ratia unei progresie aritmetice" << endl;
cout << "5.....iesire" << endl << endl;

cin >> m;

if (m == 0)
{
cout << "Daca selectezi 1 programul va determina daca A,B,C sunt
in progresie aritmetica" << endl;
cout << "Daca selectezi 2 programul va determina suma primilor n
termeni din progresie" << endl;
cout << "Daca selectezi 3 programul va determina al n-lea termen
din progresie" << endl;
cout << "Daca selectezi 4 programul va determina ratia
progresiei" << endl << endl;
}

if (m == 1)
{
cout << "Introduceti a,b,c ";
int a, b, c;
cin >> a >> b >> c;
if ((a + c) / 2 == b) cout << "DA" << endl << endl;
else cout << "NU" << endl << endl;
}

if (m == 2)
{
int x, n, r;
cout << "Introduceti x(primul termen) r (ratia) si n(nr termeni)"
<< endl;
cin >> x >> r >> n;
cout << "Suma primilor n termeni este " << x * n + (n * (n -
1)) / 2 * r << endl << endl;
}

if (m == 3)
{
int x, r, n;
cout << "Introduceti x(primul termen), r(ratia) si n(al n-lea
termen)" << endl;
cin >> x >> r >> n;
cout << "Al n-lea termen este " << x + (n - 1) * r << endl <<
endl;
}
if (m == 4)
{
int a_1, a_n, n;
cout << "introduceti a_1(primul termen), a_n(al n-lea termen) si
n" << endl;
cin >> a_1 >> a_n >> n;
cout << "Ratia este " << (a_n - a_1) / (n - 1) << endl << endl;
}

if (m == 5) p++;
}
return 0;
}

You might also like