DO NOT MISS

Ads

Thursday, 7 July 2016

C-Programs on Mathematical Problems (Ex 2)


* write a program input, Area of the Circle.

#include<stdio.h>

#include<conio.h>

void main( )

        {

        int rds;

        float area;

        clrscr( );

        rds = 6;

        area = 3.14 * rds * rds;

                 printf("Area of Circle : %f",area);

        getch( );

        }

Output:-

Area of Circle : 113.040000

* write a program input, Perimeter of the Circle.

#include<stdio.h>

#include<conio.h>

void main( )

          {

          int rds;

          float prmtr;

          clrscr( );

          rds = 6;

          prmtr = 2 * 3.14 * rds;

               printf("Perimeter of Circle : %f",prmtr);

          getch( );

          }

Output:-

Perimeter of Circle : 37.680000


* write a program input, Area and Perimeter of a Square.


#include<stdio.h>

#include<conio.h>

void main()

       {

             int area,side,perimeter;

             clrscr();

             side=6;

             area=side*side;

             perimeter=4*side;

                    printf("the area of a Square is:%d\n",area);

                    printf("the perimeter of a Square is:%d",perimeter);

             getch();

       }
Output:-

the area of a Square is: 36
the perimeter of a Square is: 24

* write a program input, Area and Perimeter of a Rectangle.


#include<stdio.h>

#include<conio.h>

void main()

      {

            int lenth,bredth,area,perimeter;

            clrscr();

            length=6;

            bredth=4;

            area=lenth*bredth;

            perimeter=2*(lenth+bredth);

                  printf("the area of a rectangle is:%d\n",area);

                  printf("the perimeter of a rectangle is:%d",perimeter);

            getch();

      }
Output:-

the area of a rectangle is: 24
the perimeter of a rectangle is:20
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

Greataims

 
Copyright © 2016 Computersadda. Designed by @ Computersadda Team - Published By Greataims