Using Some of the Math Routines - CSharp Language Basics

CSharp examples for Language Basics:Math

Description

Using Some of the Math Routines

Demo Code

using System;/*from w w  w  . j a  va  2s.com*/
class MathApp
{
   public static void Main()
   {
      int val2;
      char disp;
      for (double i = 0.0; i <= 10; i += .2)
      {
         val2 = (int) Math.Round( ( 10 * Math.Sin(i))) ;
         for( int i2 = -10; i2 <= 10; i2++ )
         {
            if (i2 == val2)
               disp = 'X';
            else
               disp = ' ';
               Console.Write("{0}", disp);
            }
            Console.WriteLine(" ");
         }
      }
}

Result


Related Tutorials