Відповідь:
C++ code:
#include <iostream>
int main(){
int size,number,counter = 0;
std::cout << "Enter size: ";
std::cin >> size;
std::cout << "Enter a number: ";
std::cin >> number;
for(int i = 0; i < size; i++){
int temp;
std::cout << i + 1 << " number: ";
std::cin >> temp;
if(temp == number){
counter++;
}
std::cout << "Counter: " << counter << std::endl;
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Відповідь:
C++ code:
#include <iostream>
int main(){
int size,number,counter = 0;
std::cout << "Enter size: ";
std::cin >> size;
std::cout << "Enter a number: ";
std::cin >> number;
for(int i = 0; i < size; i++){
int temp;
std::cout << i + 1 << " number: ";
std::cin >> temp;
if(temp == number){
counter++;
}
}
std::cout << "Counter: " << counter << std::endl;
return 0;
}