Wednesday, December 11, 2013

Perimeter C programming

/* This C program will calculate the perimeter and the area */

#include <stdio.h>
main()
{
int num1, num2;
int p, a, s;
clrscr();

printf("Enter perimeter: ");
scanf("%d",&num1);
printf("Enter area: ");
scanf("%d",&num2);

/*process*/

p=4*s;
a=s^2;

printf("\nThe perimeter is: %d", p);
printf("\nThe area is: %d", a);
getch();

}

 Here's the Output  

-------------------------------------------------

  Enter perimeter:                                            
  Enter area:                    
                              
-------------------------------------------------







No comments:

Post a Comment