Advertisement
vallec

ionka

Dec 15th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Welcome to GDB Online.
  4. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
  5. C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
  6. Code, Compile, Run and Debug online from anywhere in world.
  7.  
  8. *******************************************************************************/
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15. int n = 0;
  16. do{
  17. cout<<"Vavedi n = ";
  18. cin >> n;
  19. } while (n < 1);
  20.  
  21. int a[n];
  22. for(int i = 0; i < n; i++){
  23. cout << "a" << i << " = ";
  24. cin >> a[i];
  25. }
  26.  
  27. int num;
  28. cout << "Vavedi turseno chislo: ";
  29. cin >> num;
  30.  
  31. int count = 0;
  32. for(int i = 0; i < n; i++){
  33. if(a[i] == num){
  34. count++;
  35. }
  36. }
  37.  
  38.  
  39.  
  40. cout << "Chisloto " << num << " se sreshta " << count;
  41. if(count == 1) {
  42. cout << " put\n";
  43. } else {
  44. cout << " puti\n";
  45. }
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement