DO NOT MISS

Ads

Wednesday, 6 July 2016

C-Programs on Mathematical Problems (Ex 1)



* write a program input, Square of the number.


#include<stdio.h>

#include<conio.h>

void main( )

        {

        int num,square; 

        clrscr( ); 

        num = 7;

        square = num * num;

        printf("the square of a number is : %d ",square);

       getch( );

       }  
                                                                  

Output:-

the square of a number is : 49


* write a program input, Qube of the number.
#include<stdio.h>

#include<conio.h>

void main( )

      {


      int n,qube; 

      clrscr( ); 

      n = 3;

      qube = n * n * n;

      printf("the qube of a number is : %d ",qube);

getch( );

}
 
                                                                                        

Output:-

the qube of a number is : 27


* Write a Program input,Base and Height of a Triangle, calculate area of Triangle.


#include<stdio.h>

#include<conio.h>

void main( )

        {


        int b,h;

        float area; 


        clrscr( ); 

        b = 5;

        h = 4;

        area =1/2 * b * h;

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

       getch( );

       }
Output:-

Area of Triangle is: 10.000000
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________

Greataims

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