Wednesday, 23 April 2014

C# program to find the area of rectangle and square

:- The area of a rectangle is equal to the number of unit squares that can be fit between the boundaries the rectangle.
Area = w × h                           where, w = width        h = height

Area = a2
a = length of side

 using System;  
 using System.Collections.Generic;  
 using System.Linq;  
 using System.Text;  
 namespace area  
   class rectangle  
     public void are()  
       double l_rectangle, b_rectangle;  
       double a_rectangle;  
       double sides;  
       double a_square;  
       Console.WriteLine("enter the value of lenght and bredth of rectangle ");  
       l_rectangle =double.Parse(Console.ReadLine());  
       b_rectangle =double.Parse(Console.ReadLine());  
       a_rectangle = l_rectangle * b_rectangle;  
       Console.WriteLine("the area of rect is=" + a_rectangle);  
       Console.WriteLine("Enter the sides of the square");  
       sides = double.Parse(Console.ReadLine());  
       Console.WriteLine("the area of square is=" + a_square);  
   class program  
     static void Main(string[] args)  
       rectangle b = new rectangle();  

     enter the value of lenght and bredth of rectangle  
     the area of rect is =16  
     Enter the sides of the square  
     The area of square is =25  

No comments:
Write comments

Featured post

List of Universities in Karnataka offering M.Sc Computer Science

The post-graduate programme in Computer Science (M.Sc Computer Science) contains two academic years duration and having a four semesters....

Popular Posts

Copyright @ 2011-2016