Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Rextester.Program.Main is the entry point for your code. Don't change it.
- //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- namespace Rextester
- {
- public class Program
- {
- public static void recursividade(int numero, int passo, int exec) {
- Console.WriteLine("Estou contando {0}", numero);
- if (exec <=30)
- {
- Console.WriteLine("Contando {0}", numero);
- recursividade(numero + passo, passo, exec+1);
- }
- Console.WriteLine("Voltei aqui...{0}", numero);
- }
- public static void Main(string[] args)
- {
- int passo = 0;
- int numero = 0;
- Console.Write("Leia o passo: ");
- passo = Convert.ToInt32(Console.ReadLine());
- Console.Write("Leia o número: ");
- numero = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Início!");
- recursividade(numero, passo, 0);;
- Console.WriteLine("Fim!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment