Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #include <math.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main()
  5. {
  6. int mas[10];
  7. int n = 10;
  8. int sum = 0, i = 0, pow = 1;
  9.  
  10. for (int i = 0; i < n; i++)
  11. {
  12.  
  13. printf("mas[%d]=> ", i);
  14. scanf("%d", &mas[i]);
  15. if (i % 2 == 0)
  16. {
  17.  
  18. sum += mas[i];
  19. pow *= mas[i];
  20. }
  21.  
  22. }
  23. cout<<"Massiv"<<endl;
  24. for(int i = 0;i<10;i++){
  25. cout<<mas[i]<<" ";
  26. }
  27. cout<<endl;
  28.  
  29. printf("Summa = %d", sum);
  30. cout<<endl;
  31. printf("proizvedenie = %d", pow);
  32. cout<<"Zanulit"<<endl;
  33. int x;
  34. cin>>x;
  35. cout<<"New massiv: "<<endl;
  36. for(int i = 0;i<10;i++){
  37. if(mas[i]==x){
  38. mas[i]=0;
  39. }
  40. cout<<mas[i]<<" ";
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement