Facebook
From Flying Moth, 6 Years ago, written in C++.
Embed
Download Paste or View Raw
Hits: 211
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.         float b=0, c=0, d, min;
  6.         int a;
  7.         cout<<"podaj ilosc liczb: ";
  8.         cin>>a;
  9.        
  10.         int tablica[a]={};
  11.         for (int i=0; i<a; i++)
  12.         {
  13.                 cout<<"podaj "<<i+1<<" liczbe: ";
  14.                 cin>>tablica[i];
  15.                
  16.                 if (tablica[i]%3==0)
  17.                 {
  18.                         b=b+1;
  19.                 }
  20.                
  21.                 if (tablica[i]%5==0)
  22.                 {
  23.                         c=c+1;
  24.                 }
  25.                
  26.                
  27.         if (i==0)      
  28.         {      
  29.                 min=tablica[i];
  30.         }
  31.        
  32.         if ((tablica[i]-tablica[i-1])<0 && i!=0)
  33.                 min=tablica[i];
  34.                
  35.         }
  36.        
  37.        
  38.         cout<<b<<" liczb jest podzielnych przez 3"<<endl;
  39.         cout<<b<<" liczb jest podzielnych przez 5"<<endl;
  40.         cout<<min<<" to najmniejsza z podanych liczb";         
  41. return 0;}