daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Text;
  2. using System;
  3.  
  4.  namespace feladat
  5.  {
  6.  class feladat
  7.  {
  8.  static void Main(string [ ] args )
  9.  {
  10.         Console.Write("Bitsorozat: " );
  11.  string bitsor = Console.ReadLine ();
  12.  double osszeg=0;
  13.  double hatvany = 2;
  14.  for ( int i = 0; i < bitsor . Length ; i++)
  15.  {
  16.          hatvany= Math.Pow(2 , bitsor . Length-i-1);
  17.          string szamjegy = bitsor . Substring ( i , 1);
  18.          osszeg += int.Parse ( szamjegy )* hatvany ;
  19.  }
  20.          Console.WriteLine ("Az átváltás eredménye : {0}" , osszeg );
  21.          Console.ReadLine ();
  22.  }
  23.  }
  24.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top