Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TP0_Ejerc8
- {
- class Program
- {
- static void Main(string[] args)
- {
- int suma = 0;
- int impar = 1;
- int numero = 1;
- while (impar <= 100)
- {
- suma += numero;
- impar++;
- numero += 2;
- }
- Console.WriteLine("La suma de los primeros 100 numeros naturales impares es " + suma);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement