Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void Main (string[] args)
- {
- Console.BackgroundColor = ConsoleColor.DarkYellow;
- Console.Clear ();
- Console.WriteLine ("RESOLUÇÃO 1)Apresente os múltiplos de 5 até o número 500");
- Console.WriteLine ("Como apenas os múltiplos de 5 serão utilizados em apresentação,");
- Console.WriteLine ("Basta o incrementador ir de 5 em 5.");
- Console.ReadKey();
- Console.Clear ();
- for (int c = 0; c <= 500; c = c + 5)
- {
- Console.Write(c+",");
- }
- Console.ReadKey();
- Console.BackgroundColor = ConsoleColor.DarkRed;
- Console.Clear ();
- Console.WriteLine ("RESOLUÇÃO 2)Contando de 1 a 100, cada múltiplo de 10 deve apresentar \"Múltiplo de 10\"");
- Console.WriteLine ("Basta um if. Podemos fazer de duas formas:");
- Console.WriteLine ("a) 10, 20, 30, 40, 50, 60, 70, 80, 90 e 100 são múltiplos de 10");
- Console.ReadKey ();
- Console.Clear ();
- for (int c = 1; c <= 100; c++)
- {
- if ((c == 10) || (c == 20) || (c == 30) || (c == 40) || (c == 50) || (c == 60) || (c == 70) || (c == 80) || (c == 90) || (c == 100)) {
- Console.WriteLine (c+" é Múltiplo de 10!");
- } else {
- Console.WriteLine(c);
- }
- }
- Console.ReadKey ();
- Console.Clear ();
- Console.WriteLine ("b) Mas vimos como obter o resto da divisão usando o %!");
- Console.ReadKey ();
- Console.Clear ();
- for (int c = 1; c <= 100; c++)
- {
- if (c%10==0) {
- Console.WriteLine(c+" é Múltiplo de 10!");
- }else {
- Console.WriteLine(c);
- }
- }
- Console.ReadKey();
- Console.BackgroundColor = ConsoleColor.DarkGreen;
- Console.Clear();
- Console.WriteLine ("RESOLUÇÃO 3)Apresentar 0 a 100 em ordem inversa");
- Console.WriteLine ("Ou seja, de 100 a 0!''");
- Console.ReadKey();
- Console.Clear();
- for (int c = 100; c >= 0; c--) {
- Console.WriteLine (c);
- }
- Console.ReadKey ();
- Console.BackgroundColor = ConsoleColor.DarkGray;
- Console.Clear ();
- Console.WriteLine ("RESOLUÇÃO 4) Sequência fibonacci até o nº 60");
- Console.WriteLine ("0,1,1,2,3,5,8,13,21,34,55");
- Console.ReadKey();
- Console.Clear();
- Console.WriteLine ("Os dois primeiros números são 0 e 1, a sequencia é sempre o último mais o penúltimo.");
- Console.Write ("0,1,");
- int penultimo = 0;
- int ultimo = 1;
- for (int c = 1; c <= 60; c=ultimo+penultimo) {
- Console.Write (c + ",");
- penultimo = ultimo;
- ultimo = c;
- }
- Console.Write ("Fim!");
- Console.ReadKey ();
- }
Advertisement
Add Comment
Please, Sign In to add comment