Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int predkosc[3];
- int czas[3];
- int droga[3];
- for(int i=0; i<3; i++)
- {
- cout<<"Podaj predkosc "<<i<<" pojazdu: ";
- cin>>predkosc[i];
- cout<<"Podaj czas "<<i<<" pojazdu: ";
- cin>>czas[i];
- }
- for(int i=0; i<3; i++)
- {
- droga[i]=predkosc[i]*czas[i];
- }
- int mind=droga[0];
- int flag=0;
- for(int i=0; i<3; i++)
- {
- if (mind>droga[i])
- {
- mind=droga[i];
- flag=i;
- }
- }
- cout<<"Najkrotsza droga przejechal pojazd nr "<<flag<<" z predkoscia: "<<mind;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement