1.
#include <iostream>
using namespace std;
int main(){
int n, p;
cin >> n;
int a[n];
for(int i = 0; i!=n; i++)
cin >> a[i];
cout << a[i] << " ";
cout << endl << "Введите число k ";
cin >> p;
if(a[i]>p)
cout << a[i];
return 0;
}
2.
int n, sum = 0;
for(int i = 0; i!=n ;i++){
sum = sum + a[i];
for(int i = 0; i!=n ;i++)
cout << endl << sum;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
1.
#include <iostream>
using namespace std;
int main(){
int n, p;
cin >> n;
int a[n];
for(int i = 0; i!=n; i++)
cin >> a[i];
for(int i = 0; i!=n; i++)
cout << a[i] << " ";
cout << endl << "Введите число k ";
cin >> p;
for(int i = 0; i!=n; i++)
if(a[i]>p)
cout << a[i];
return 0;
}
2.
#include <iostream>
using namespace std;
int main(){
int n, sum = 0;
cin >> n;
int a[n];
for(int i = 0; i!=n ;i++){
cin >> a[i];
sum = sum + a[i];
}
for(int i = 0; i!=n ;i++)
cout << a[i] << " ";
cout << endl << sum;
return 0;
}