View Single Post
ישן 17-05-06, 15:21   # 37
Alter
תודה על תרומתך.
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 35
הודעות: 3,103

Alter לא מחובר  

ציטוט:
נכתב במקור על ידי 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);
__________________
Alter.
  Reply With Quote