jueves, 3 de diciembre de 2009

8

8_ ingresar 4 números reales y obtener el cociente de la suma de los dos primeros y  de la diferencia de los dos últimos 
C:
#include
main()
{
   float A,B,C,D,cociente;
   printf ("ingrese el primer numero: ");
   scanf ("%D",&A);
   printf ("ingrese el segundo numero: ");
   scanf ("%D",&B);
   printf ("ingrese el tercer numero: ");
   scanf ("%D",&C);
   printf ("ingrese el cuarto numero: ");
   scanf ("%D",&D);
   cociente =(A+B)/(C-D);
   printf ("el cociente es: %D",cociente);
 }

Clip52:
cls
num1=0;num2=0;num3=0;num4=0;cociente=0
@2,3 say "ingrese el primer numero: " get num1
@3,3 say "ingrese el segundo numero: " get num2
@4,3 say "ingrese el tercer numero: " get num3
@5,3 say "ingrese el cuarto numero: " get num4
read
cociente=(num1+num2)/(num3-num4)
@10,3 say "el cociente es: " + str (cociente)
inkey (0)

Python
#!/usr/bin/python
num1=float(raw_input("ingresar el primer numero: "))
num2=float(raw_input("ingresar el segundo numero: "))
num3=float(raw_input("ingresar el tercero numero: "))
num4=float(raw_input("ingresar el cuarto numero: "))
cociente=(num1+num2)/(num3-num4)
print ("el cociente es: ") + str (cociente)

No hay comentarios:

Publicar un comentario