Formula based program

In this blog, we are going to code different formulae that usually asked. Many of us get confused between loops and conditions. And it is also one of the most asked interview questions.
 
Formula based program

In the table given below, we have listed out various formula based program.

Note: If you are new to C# and Console Application. Try to code First C# Program

Note: Read articles on how to use Loops and Conditions.

Let’s find out a simple and easy way to code these formula.

S.no.
Formula Program
1.     
Source code to check leap year

Enter a year: 2016
Year is a leap year

Click to view source code

2.     
Source code to find perimeter and area of circle

Enter radius: 7
Perimeter of circle: 43.9822971502571
Area of circle: 153.9380400259

Click to view source code

3.     
Source code to find perimeter and area of semi-circle

Enter radius: 7
Perimeter of circle: 43.9822971502571
Area of circle: 153.9380400259

Click to view source code

4.     
Source code to find perimeter and area of rectangle

Enter length: 5
Enter breadth: 3
Perimeter of rectangle: 16
Area of rectangle: 15

Click to view source code

5.     
Source code to find perimeter and area of square

Enter length of side: 5
Perimeter of square: 20
Area of square: 25

Click to view source code

6.     
Source code to find area of triangle

Enter length of base: 5
Enter height: 10
Area of triangle: 25

Click to view source code

7.     
Source code to find perimeter and area of rhombus

Enter length of side: 5
Perimeter of rhombus: 20
Area of rhombus: 25

Click to view source code

8.     
Source code to find perimeter and area of parallelogram

Enter length of side: 5
Enter height: 6
Perimeter of parallelogram: 22
Area of parallelogram: 30

Click to view source code

9.     
Source code to calculate percentage and obtained value

(a) Find percentage (b) Find obtained value
Enter your selection a/b: b
Enter total value: 500
Enter percentage: 86
Obtained Value: 430

Click to view source code

10.   
Source code to find student grade

Enter percentage: 87
Hurrah! You got: A grade

Click to view source code

11.   
Source code to convert Celsius to Fahrenheit and vice-versa

(a) Convert Celsius to Fahrenheit (b) Convert Fahrenheit to Celsius
Enter your selection a/b: b
Enter temperature in Fahrenheit: 100.4
Temperature in Celsius: 38

Click to view source code



For any query, comment us below.

Previous – Number series program



Click
imagination hunt to read latest blogs.

Keep learning and sharing...

Comments

Popular posts from this blog

SSC CGL 2016 Tier-1 Marks / Result

DATA TYPES IN C#

Pattern printing program

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Top Mutual Funds