Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 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 ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int num;
  14.             int x = 0;
  15.             int somma = 0;
  16.             for(i=0; i<10; i++) {
  17.                 Console.WriteLine("Inserire numero intero compreso tra 0 e 255.");
  18.                 num = int.Parse(Console.ReadLine());
  19.                 if(num>255 || num<0) {
  20.                     i--;
  21.                     Console.WriteLine("Testa di cazzo, ho detto tra 0 e 255...");
  22.                 }
  23.                 else somma = somma + num;
  24.             }
  25.             Console.WriteLine("La somma dei numeri รจ " + somma);
  26.             Console.ReadLine();
  27.         }  
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement