hercioneto

Algoritmo 1 de 25-09-18

Sep 25th, 2018
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. //Rextester.Program.Main is the entry point for your code. Don't change it.
  2. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
  3.  
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text.RegularExpressions;
  8.  
  9. namespace Rextester
  10. {
  11.     public class Program
  12.     {
  13.        
  14.          public static void recursividade(int numero) {
  15.             Console.WriteLine("Estou contando {0}", numero);
  16.  
  17.            if (numero <=50)
  18.             {
  19.                
  20.                 Console.WriteLine("Contando {0}", numero);
  21.                 recursividade(numero + 2);
  22.             }
  23.              Console.WriteLine("Voltei aqui...{0}", numero);
  24.         }
  25.        
  26.         public static void Main(string[] args)
  27.         {
  28.             Console.WriteLine("Início!");
  29.             recursividade(2);
  30.             Console.WriteLine("Fim!");
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment