Advertisement
ntamas

intervallumfelezés

Mar 28th, 2014
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Diagnostics;
  6. using System.Threading;
  7.  
  8. namespace ConsoleApplication1
  9. {
  10.   class Program
  11.   {
  12.     static void Main(string[] args)
  13.     {
  14.       int i;
  15.       double a, b, p, d;
  16.       Console.Write("Írd be az alsó határt: ");
  17.       a = Convert.ToDouble(Console.ReadLine());
  18.       Console.Write("Írd be a felső határt: ");
  19.       b = Convert.ToDouble(Console.ReadLine());
  20.       Console.Write("Hány részre szeretnéd osztani? ");
  21.       int n = Convert.ToInt32(Console.ReadLine());
  22.       for (i = 0, p=a, d=(b-a)/n; i <= n; i++, p+=d)
  23.       {
  24.         Console.WriteLine("{0,8:0.00} ", p);
  25.       }
  26.       Console.ReadKey();
  27.     }
  28.   }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement