SHARE
TWEET

Proiect1

a guest Apr 24th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int a[10];
  4. int n,i,p;
  5. int citire(int &n, int a[])
  6. {
  7.     cout<<"n=";
  8.     cin>>n;
  9.     for(i=0;i<n;i++)
  10.     {
  11.         cout<<"a["<<i<<"]=";
  12.         cin>>a[i];
  13.         cout<<endl;
  14.     }
  15.  
  16. }
  17. int afisare(int n, int a[])
  18. {
  19.     cout<<"afiseaza vectorul";
  20.     for(i=0;i<n;i++)
  21.         cout<<a[i]<<" ";
  22.  
  23. }
  24. int pare(int n, int a[])
  25. {
  26.     cout<<"Numere pare ";
  27.     for(i=0;i<n;i++)
  28.         if(a[i]%2==0)
  29.         cout<<a[i];
  30. }
  31. int pare_impare(int n, int a[])
  32. {
  33.   cout<<"Vector paritate";
  34.   for(i=0;i<n;i++)
  35.     if(a[i]%2==0)
  36.     cout<<1<<" ";
  37.   else cout<<0<<" ";
  38. }
  39. int intrerupere(int n,int a[])
  40. {
  41.     cout<<"Vector intrerupere";
  42.     i=0;
  43.     do{
  44.         cout<<a[i];
  45.         i++;
  46.     }while((a[i-1]!=0)&&(i<n));
  47.  
  48. }
  49. int produs_impare(int n, int a[])
  50. {
  51.     p=1;
  52.     cout<<endl;
  53.     for(i=0;i<n;i++)
  54.         if(a[i]%2!=0)
  55.         p=a[i]*p;
  56.     cout<<p;
  57. }
  58. int main()
  59. {
  60.     citire(n,a);
  61.     afisare(n,a);
  62.     pare(n,a);
  63.     pare_impare(n,a);
  64.     intrerupere(n,a);
  65.     produs_impare(n,a);
  66.     return 0;
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top