var
a,k,s: integer;
begin
repeat
write (' = > '); readln(a);
if a< 0 then k: =k+1 else s: =s+a;
until a=0;
writeln ('summa: ',s);
writeln ('kol-vo: ',k);
readln;
end.
#include < iostream>
using namespace std;
int main() {
int h, m, s, time;
cin > > h > > m > > s > > time;
int hour, minute, second;
second = time % 60;
time -= second;
time = time/60;
minute = time % 60 ;
hour = time / 60;
if ( s + second > 60 ) {
s = (s+second) % 60;
if ( m + minute + 1 > 60 ) {
m = (m+minute+1) % 60;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h+=hour+1;
}
} else if( m + minute + 1 == 60 ) {
m = 0;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h+=hour+1;
}
} else {
m = m+minute;
if ( h + hour > = 24 ) {
h = (h+hour) % 24;
} else {
h += hour;
}
}
} else if ( s+second == 60 ) {
s = (s+second) % 60;
if ( m + minute + 1 > 60 ) {
m = (m+minute+1) % 60;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h+=hour+1;
}
} else if( m + minute + 1 == 60 ) {
m = 0;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h +=hour+1;
}
} else {
m += minute;
if ( h + hour > = 24 ) {
h = (h+hour) % 24;
} else {
h = h + hour;
}
}
} else {
s = s+second;
if ( m + minute > 60 ) {
m = (m+minute) % 60;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h+=hour+1;
}
} else if( m + minute == 60 ) {
m = 0;
if ( h + hour + 1 > = 24 ) {
h = (h+hour+1) % 24;
} else {
h += hour+1;
}
} else {
m += minute;
if ( h + hour > = 24 ) {
h = (h+hour) % 24;
} else {
h += hour;
}
}
}
cout < < h < < ": " < < m < < ": " < < s;
}
Поделитесь своими знаниями, ответьте на вопрос:
program msdos; uses crt; var r,sum: real; neg: integer; begin writeln('*** alphaues is ***'); writeln('*** ok ***'); neg: =0; sum: =0; r: =1; writeln('введите ненулевое число'); writeln('(или введите 0 для конца последовательности) '); while r< > 0 do begin write('ввод: '); readln (r); if r< 0 then neg: =neg+1; if r> 0 then sum: =sum+r; end; writeln(); writeln('количество отрицательных чисел ',neg); writeln('сумма положительных чисел ',sum); end.