Monday, 2 July 2012

Basic C Programming001

Square, Cube, and Fourth of an input number.

#include <stdio.h>
#include <conio.h>

void main ( )
{
        int x, m, n, p;
        clrscr ( );
            
        printf ("\n Enter a number: -"); scanf ("%d",&x);
                 
        m = x * x;
        n = x * x * x;
        p = x * x * x * x;
                    
        printf ("\n Square of the entered number : - %d", m);
        printf ("\n Cube of the entered number : - %d", n);
        printf ("\n Fourth of the entered number : - %d", m);
        getch ( );
}

Click here to contact us

Area of a Circle.

#include <stdio.h>
#include <conio.h>

void main ( )
{
        float r, a, p = 3.14 ;
        clrscr ( );
             
        printf ("\n Enter the radius of a circle : -"); scanf ("%f",&r);
                
        a = r * r * p;
                
        printf ("\n The area of Circle is : - %f", a);
        getch ( );
}

Click here to contact us 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...