23.1.23020052. Generisati 3 dvocifrena broja. Naći sumu manjih od 44.
Opis rješenja:
Listing programa:
//23020052
#include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main(){
srand(time(NULL));
int a=rand()%89+10,b=rand()%89+10,c=rand()%89+10;
int suma;
cout<<a<<" "<<b<<" "<<c<<endl;
if(a < 44){
suma=suma+a;
}
if(b < 44){
suma=suma+b;
}
if(c < 44){
suma=suma+c;
}
cout<<"Suma manjih od 44 je: "<<suma<<endl;
return 0;
}
Ispis na ekranu:
Riješeni zadaci Index
|