ציטוט:
נכתב במקור על ידי Ori
פתרון שאלה 3 :
קוד:
sum:=0;
count:=0;
For I:=1 to 62 do
begin
if (A[I] >= 100) and (A[I] <= 999) then
begin
sum:=sum+A[I];
if (A[I] > 248) then
count:=count+1;
end;
end;
writeln(sum);
writeln(count);
|
ובשפת C למי שעשה C...
קוד:
sum=0;
count=0;
for (i=1;i<62;i++){
if (a[i] >= 100 && a[i] <= 999) {
sum=sum+a[i];
if (a[i] > 248)
count=count+1;
}
}
printf("%d",sum);
printf("%d",count);