Home
О нас
Products
Services
Регистрация
Войти
Поиск
Lojlka
@Lojlka
September 2021
2
12
Report
Написать программу вычисления количества ненулевых элементов одномерного массива. В C++
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
c0der
#include <iostream>
using namespace std;
int main(){
int ar[10];
int k=0;
for(int i=0;i<10;i++){
cin>>ar[i];
if(ar[i]!=0)
k++;
}
cout<<k;
cin.get();
cin.get();
}
Пример ввода:
1
0
0
0
0
1
1
1
1
Пример вывода:
6
0 votes
Thanks 0
Gleb1Kosyrev
Verified answer
#include <cstdlib>#include <iostream>
using namespace std;
void MassNullEllement(int *Mass){
int KolEl = 0 ;
for(int a=0;a<5;a++){
if(Mass[a]!=0){KolEl++;}
}
cout<<"amount element not equal zero = "<<KolEl<<"\n";
}
int main(int argc, char *argv[])
{
int Massiv[5];
for(int b=0;b<5;b++){
cout<<"Enter "<<b<<" element - ";
cin>>Massiv[b];
}
MassNullEllement(Massiv);
system("PAUSE");
return EXIT_SUCCESS;}
0 votes
Thanks 0
More Questions From This User
See All
Lojlka
June 2023 | 0 Ответы
116e0282d7ad68918b3d96eb6c329fed
Answer
Lojlka
August 2022 | 0 Ответы
reshite pozhalujsta 36
Answer
Lojlka
July 2022 | 0 Ответы
409 pozhalujsta pomogite podcherknite odnorodnye chleny
Answer
Lojlka
July 2022 | 0 Ответы
odno iz ochevidnyh preimushestv alternativnoj mediciny otsutstvie pobochnyh effe
Answer
Lojlka
July 2022 | 0 Ответы
chto ty dumaesh o takih veshah kak art terapiya muzykalnaya terapiya iscelenie s
Answer
Lojlka
July 2022 | 0 Ответы
izmenite predlozheniya iz aktivnogo v passivnyj nomer 2 pozhaaaalujsta
Answer
Lojlka
July 2022 | 0 Ответы
izmenit aktivnyj golos v passivnyj v sleduyushih predlozheniyah 1 acid rain and a
Answer
Lojlka
July 2022 | 0 Ответы
zaklnchite uravneniya reakcij 1 h2 nh3 2kh2o koh 3
Answer
Lojlka
July 2022 | 0 Ответы
3 zadanie pozhalujstac8ad448009b3adfee2785d2f804e92ee 67747
Answer
Lojlka
July 2022 | 0 Ответы
reshite uravnenie9h 3h 423h1
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Написать программу вычисления количества ненулевых элементов одномерного массива..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
using namespace std;
int main(){
int ar[10];
int k=0;
for(int i=0;i<10;i++){
cin>>ar[i];
if(ar[i]!=0)
k++;
}
cout<<k;
cin.get();
cin.get();
}
Пример ввода:
1
0
0
0
0
1
1
1
1
Пример вывода:
6
Verified answer
#include <cstdlib>#include <iostream> using namespace std; void MassNullEllement(int *Mass){ int KolEl = 0 ; for(int a=0;a<5;a++){ if(Mass[a]!=0){KolEl++;} } cout<<"amount element not equal zero = "<<KolEl<<"\n"; } int main(int argc, char *argv[]){ int Massiv[5]; for(int b=0;b<5;b++){ cout<<"Enter "<<b<<" element - ";cin>>Massiv[b]; } MassNullEllement(Massiv); system("PAUSE"); return EXIT_SUCCESS;}