Enunciado
Leer dos fechas f1 y f2 en formato AAMMDD. Informar cuál de ellas es la anterior o si son iguales.
Código
Python
def main():
f1 = int( input( "Fecha/Date (AAMMDD) 1: " ) )
f2 = int( input( "Fecha/Date (AAMMDD) 2: " ) )
if f1==f2:
print( "\nf1 = f2" )
else:
if f1<f2:
print( "\nf1 < f2" )
else:
print( "\nf1 > f2" )
input( "Presionar/Press Enter to exit " )
main()
C++
#include <iostream>
using namespace std ;
#include <conio.h>
int main ()
{
int f1, f2 ;
cout << endl << "Fecha/Date (AAMMDD) 1: " ;
cin >> f1 ;
cout << endl << "Fecha/Date (AAMMDD) 2: " ;
cin >> f2 ;
if ( f1==f2 )
cout << endl << "f1 = f2" ;
else
if ( f1<f2 )
cout << endl << "f1 < f2" ;
else
cout << endl << "f2 > f1" ;
cout << "Presionar/Press Enter to exit " ;
getch() ;
return 0 ;
}
Pascal
Program Problema7_2 ;
var
f1, f2 : longint ;
begin
write( 'Fecha/Date 1 (AAMMDD): ' ) ; readln( f1 ) ;
write( 'Fecha/Date 2 (AAMMDD): ' ) ; readln( f2 ) ;
if f1=f2 then writeln( 'f1 = f2' )
else if f1<f2
then writeln( 'f1 < f2' )
else writeln( 'f1 > f2' ) ;
writeln( 'Presionar/Press Enter to exit' ) ;
readln ;
end.
Diagramas


