Welcome To Uday Satya Blog

06 - 10 PROGRAMS


/* *******************************************************
       6.To Find the Average of Two Numbers
    ******************************************************* */

   #include<*stdio.h>
   #include<*conio.h>
   void main()
    {
     float a,b,Avg;
     clrscr();
     printf("\n Enter any Two Numbers,To Find Average of Them:");
     scanf ("%f %f", &a, &b);
     Avg = (a+b)/2;
     printf("\n\n The Average of Two numbers is : %f",Avg);
     getch();
    }

   Output :

   Enter any Two Numbers,To Find Average of Them : 4 6

   The Average of Two Numbers is : 5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* *******************************************************
         7.To Calculate Value of Simple Intrest
    ******************************************************* */

    #include<*stdio.h>
   #include<*conio.h>
   void main()
    {
     float p,n,r,si;
     clrscr();
     printf("\n Enter The Values of : \n");
     printf("\n The Principal Value(P) = ");
     scanf("%f", &p);
     printf("\n The Number of Years(N) = ");
     scanf("%f", &n);
     printf("\n The Rate of Intrest(R) = ");
     scanf("%f", &r);
     si = p*n*r/100;
     printf("\n\n The Simple Intrest Value is : %f", si);
     getch();
    }

   Output :
   Enter The Values of  :
   The Principal Value(P) = 1000
   The Number of Years(N) = 1
   The Rate of Intrest(R) = 0.5
  
   The Simple Intrest Value is : 5
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* *******************************************************
              8.To Calculate Area of Triangle
    ******************************************************* */

   #include<*stdio.h>
   #include<*conio.h>
   void main()
    {
     float b,h,area;
     clrscr();
     printf("\n Enter The Length of : \n");
     printf("\n Base(b) of Triangle = ");
     scanf("%f", &b);
     printf("\n Height(h) of Triangle = ");
     scanf("%f", &h);
     area = b*h*1/2;
     printf("\n\n The Area of Given Traingle is : %f", area);
     getch();
    }

  Output :
  Enter The Length of :
  Base(b) of Triangle = 2
  Height(h) of Triangle = 6

  The Area of Given Triangle is : 6 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* *******************************************************
          9.To Calculate Circumference of Circle
    ******************************************************* */

   #include<*stdio.h>
   #include<*conio.h>
   #define pi 3.14
   void main()
    {
     float r,circum;
     clrscr();
     printf("\n Enter The Length of Radius(r) : ");
     scanf("%f", &r);
     circum = 2*pi*r;
     printf("\n\n The Circumference of Given Circle is : %f", circum);
     getch();
    }

  Output :

  Enter The Length of Radius(r) : 1

  The Circumference of Given Circle is : 3.14
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* ******************************************************************
             10.To Find the Surface Area of Cylinder
    ****************************************************************** */

   #include
   #include
   #define pi 3.14
   void main()
    {
    float r,h,sa;
    clrscr();
    printf("\n Enter the Values of : \n");
    printf("\n Radius of Cylinder =  ");
    scanf("%f", &r);
    printf("\n Length/Height of Cylinder = ");
    scanf("%f", &h);
    sa = 2*pi*r*h;
    printf("\n\n Surface Area of Given Cylinder is : %f \n", sa);
    getch();
    }

   Output :
   Enter the Values of :
   Radius of Cylinder = 1
   Length/Height of Cylinder = 2
 
   Surface Area of Given Cylinder is : 12.56
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

0 comments:

Post a Comment