Centro de Estudios Superiores Felipe II (CES Felipe)
software
Curso en C# (ESTRADA)
All documents for this subject (4)
Seller
Follow
natanielestrada
Content preview
1. Mostrar los múltiplos de 3 y de 2 entre el 0 y 100
using System;
public class Program
{
public static void Main()
{
//programa: numeros impares y pares
//alumno: nataniel ezequiel estrada mendoza
//grupo:3101
/*este programa muestra los numeros de 3 en 3 hasta el 100 y de igual
manera
y de igual manera muestra de dos en dos los numeros pares del 1 al
100 */
int multiploTres = 0; //Variable múltiplo de 3
int contadorMultiploTres = 0;
int multiplodos = 0; //Variable múltiplo de 3
int contadorMultiplodos = 0;
do
{
Console.WriteLine("Los múltiplos de tres del cero al cien son:
{0}", multiploTres); //Muestra en pantalla los múltiplos de 3
multiploTres = multiploTres + 3; //Los múltiplos de tres se
incrementan de 3 en 3
contadorMultiploTres = contadorMultiploTres + 1;
}
while (multiploTres < 100); //Hasta que llegue a 100
Console.WriteLine("El número de múltiplos de tres encontrados es de:
{0}", contadorMultiploTres);
Console.WriteLine("\n");
do
, {
Console.WriteLine("Los múltiplos de 2 del cero al cien son: {0}",
multiplodos); //Muestra en pantalla los múltiplos de 3
multiplodos = multiplodos + 2; //Los múltiplos de tres se
incrementan de 3 en 3
contadorMultiplodos = contadorMultiplodos + 1;
}
while (multiplodos < 100); //Hasta que llegue a 100
Console.WriteLine("El número de múltiplos de 2 encontrados es de:
{0}", contadorMultiplodos);
}
}
2. Contar los múltiplos de 5 desde la unidad hasta un número que ingresamos
, using System;
public class Program
{
public static void Main()
{
int multiplocinco = 0; //Variable múltiplo de 3
int contadorMultiplocinco = 0;
do
{
Console.WriteLine("Los múltiplos de 5 del cero al cien son: {0}",
multiplocinco); //Muestra en pantalla los múltiplos de 3
multiplocinco = multiplocinco + 5; //Los múltiplos de tres se
incrementan de 5 en 5
contadorMultiplocinco = contadorMultiplocinco + 1;
}
while (multiplocinco < 100); //Hasta que llegue a 100
Console.WriteLine("El número de múltiplos de 5 encontrados es de:
{0}", contadorMultiplocinco);
}
}
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller natanielestrada. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $8.99. You're not tied to anything after your purchase.