0% found this document useful (0 votes)
20 views

Progra3, 3

This document contains code snippets from two programming exercises. The first exercise uses a while loop to display a forward slash character moving across the screen in increments of 2 until it reaches 100. The second exercise uses nested while loops to identify and output all even numbers between 1 and 100.

Uploaded by

Jorge Velasquez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Progra3, 3

This document contains code snippets from two programming exercises. The first exercise uses a while loop to display a forward slash character moving across the screen in increments of 2 until it reaches 100. The second exercise uses nested while loops to identify and output all even numbers between 1 and 100.

Uploaded by

Jorge Velasquez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Instituto por

Cooperativa Villa
Hermosa
Nombre: Jorge Yonatan Apellido:
Velásquez Ovalle Maestro: Jimmy
beliz Grado: 5to Perito Sección: B

CARGA Y NUMEROS PARES


Fecha: 04/07/2023
EJERCICIO 1
using System;
using System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading; using
System.Threading.Tasks;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{ int conta
= 0; while (conta
< 100)
{
conta = conta + 2;
Console.SetCursorPosition(conta, 12);

Console.Write("/");
Thread.Sleep(300);

Console.SetCursorPosition(50, 13);
Console.Write(conta + "%");

Thread.Sleep(300);

Console.ForegroundColor = ConsoleColor.DarkYellow;

Console.ReadLine();
}
}
}
EJERCICIO 2
using System;
using System.Collections.Generic;
using System.Linq; using
System.Text; using
System.Threading.Tasks;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Jorge Velasquez Ovalle";
int dividendo = 2; int
divisor = 1; int contador =
0;

while (dividendo <= 100)


{
while (divisor <= dividendo)
{
if (dividendo % divisor == 0)
{
contador++; }
divisor++; }
if (contador == 2)
{
Console.WriteLine("" + dividendo);
}
dividendo++;
divisor = 1;
contador = 0;
}

Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.ReadLine();
}
} }

You might also like