Advertisement
Guest User

Ejercicio_8

a guest
Aug 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int repe = 1;
  14.             int suma = 0;
  15.  
  16.             for (int i = 1; repe <= 100; i += 2)
  17.             {
  18.                 suma = suma + i;
  19.                 repe++;
  20.             }
  21.  
  22.             Console.Write("La suma de los primeros 100 numeros impares es de: " + suma);
  23.             Console.ReadKey();
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement