Sunteți pe pagina 1din 3

OPERADORES LÓGICOS OPERADORES RELACIONADOS

PSEUDOCODIGO C# PSEUDOCODIGO C#
Y && > >
O || < <
NO ! >= >=
<= <=
= ==
<> !=
EJERCICIO Nº 1
 Leer 2 notas de un alumno y mostrar el mensaje según su promedio, “APROBADO” O
“DESAPROBADO”

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double n1, n2, prom;
Console.Write("ingrese 1º nota :");
n1 = double.Parse(Console.ReadLine());
Console.Write("ingrese 2º nota :");
n2 = double.Parse(Console.ReadLine());
prom = (n1 + n2) / 2;
Console.WriteLine("promedio : {0}", prom);
if (prom >= 10.5) No tiene; porque en un c:
Console.WriteLine("APROBADO");
else
Console.WriteLine("DESAPROBADO");
Console.ReadLine();
}
}
}
EJERCICIO Nº 2
 Leer 2 notas de un alumno y mostrar el mensaje según su promedio

PROMEDIO MENSAJE
0 - 10.49 DESAPROBADO
10.5 - 13.49 REGULAR
13.50 – 16.49 MUY BIEN
16.5 – 20.00 EXCELENTE

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
double n1, n2, prom;
Console.Write("ingrese 1º nota :");
n1 = double.Parse(Console.ReadLine());
Console.Write("ingrese 2º nota :");
n2 = double.Parse(Console.ReadLine());
prom = (n1 + n2) / 2;
Console.WriteLine("promedio : {0}", prom);
if (prom >= 0 && prom <= 10.49)
Console.WriteLine("DESAPROBADO");
else if (prom >= 10.50 && prom <= 13.49)
Console.WriteLine("REGULAR");
else if (prom >= 13.50 && prom <= 16.49)
Console.WriteLine("MUY BIEN");
else
Console.WriteLine("EXCELENTE");
Console.ReadLine();
}
}
}
EJERCICIO Nº 3
 Hacer un concurso de un participante en la cual debe de ingresar sus datos, y
sacar una de las 3 “llaves” para que gane un premio.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string nombre;
string direccion;
int premio;
Console.WriteLine("Ingrese Numero de llave)");
Console.WriteLine("llave (1) llave(2) llave (3)");
Console.Write("Nombre :");
nombre = (Console.ReadLine());
Console.Write("Direccion :");
direccion = (Console.ReadLine());
Console.Write("Numero de llave :");
premio = int.Parse(Console.ReadLine());
if (premio == 1)
Console.WriteLine("GANO S/.10,000 NUEVOS SOLES");
else if (premio == 2)
Console.WriteLine("GANO UNA CASA");
else if (premio == 3)
Console.WriteLine("NO EXISTE PREMIO");
Console.ReadLine();
}
}
}

S-ar putea să vă placă și