Guest User

Untitled

a guest
Jun 20th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. using System;
  2. class sommapari
  3. {  
  4.     static void Main()
  5.     {
  6.         int m = 2, n = 5, somma = 0;
  7.         do
  8.         {
  9.             Console.WriteLine("Inserisci m: ");
  10.             m = Convert.ToInt32(Console.ReadLine());
  11.         }while(m<0);
  12.        
  13.         do
  14.         {
  15.             Console.WriteLine("Inserisci n: ");
  16.             n = Convert.ToInt32(Console.ReadLine());
  17.         }while(n<m);
  18.        
  19.         somma = m;
  20.         while(m<n)
  21.             somma += (++m);
  22.         Console.WriteLine("La somma รจ: " + somma);
  23.         Console.ReadKey();
  24.     }  
  25. }
Add Comment
Please, Sign In to add comment