Guest User

Untitled

a guest
Jan 21st, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ex_9
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int actual = int.MinValue;
  13.             int anterior;
  14.             int contador = 0;
  15.  
  16.             for (int i = 0; i < 10; i++)
  17.             {
  18.                 anterior = actual;
  19.                 Console.Write("Insira o {0} numero: ", i);
  20.                 actual = int.Parse(Console.ReadLine());
  21.  
  22.                 if (actual == anterior)
  23.                 {
  24.                     contador++;
  25.                 }
  26.  
  27.             }
  28.  
  29.             Console.Write("\nForam inseridos {0} numeros iguais ao antecessor", contador);
  30.             Console.ReadKey();
  31.         }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment