Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
ejercicios de c#

# ejercicios de c#

Ratings:

4.5

(2)
|Views: 3,638|Likes:

### Availability:

See more
See less

05/23/2013

pdf

text

original

PROGARAMA PARA DE SORTEOusing System;using System.Collections.Generic;using System.Text;namespace Exercici22_UD2{class Program{static void Main(string[] args){Random r = new Random();int num,cupo,r1,r2,r3,r4,n1,n2,n3,n4,a1,a2,a3,a4,c1,c2,c3,c4;cupo = r.Next(100000);Console.WriteLine("Que numero tenemos(5 digitos)");num =Convert.ToInt32(Console.ReadLine());Console.WriteLine("el numero premiadoes " + cupo);n1 = cupo / 10;r1 = cupo % 10;n2 = n1 / 10;r2 = n1 % 10;n3 = n2 / 10;r3 = n2 % 10;n4 = n2 / 10;r4 = n3 / 10;a1 = num / 10;c1 = num % 10;a2 = a1 / 10;c2 = a1 % 10;a3 = a2 / 10;c3 = a2 / 10;

a4 = a3 / 10;c4 = a3 % 10; if (num==cupo)Console.WriteLine("Coincidencia de los 5 digitos,has ganado 33.000 euros");else if (r1==c1 && r2==c2 && r3==c3&& r4==c4) Console.WriteLine("Coincidencia de los4 ultimos digitos, has ganado 150 euros");else if (r1==c1 && r2==c2 && r3==c3)Console.WriteLine("Coincidencia de los 3 ultimosdigitos, has guanyat 15 euros");else if (r1==c1 && r2==c2)Console.WriteLine("Coincidencia de los 2 ultimosdigitos, has ganado 5 euros");else if (r1==c1)Console.WriteLine("Coincidencia en el ultimodigito, has ganado 1,5 euros");else Console.WriteLine("Ningunacoincidencia, no has ganado nada");}}}
RELOJ DIGITAL CON ALARMA
using System;using System.Collections.Generic;using System.Text;namespace rellotgeDigitalAmbAlarma

{class Program{static void Main(string[] args){Console.ForegroundColor =ConsoleColor.Red;Console.BackgroundColor =ConsoleColor.Yellow;Console.Clear();int h, m, s, x;int alarmaH, alarmaM, alarmaS;String alarma;Console.WriteLine("Introdueix leshores");h =Convert.ToInt32(Console.ReadLine());Console.WriteLine("Introdueix elsminuts");m =Convert.ToInt32(Console.ReadLine());Console.WriteLine("Introdueix elssegons");s =Convert.ToInt32(Console.ReadLine());Console.WriteLine("Vols possaralarma, si o no");alarma =Convert.ToString(Console.ReadLine());if (alarma == "si"){Console.Clear();Console.WriteLine("Introdueix leshores de l'alarma");alarmaH =Convert.ToInt32(Console.ReadLine());