Friday, July 31, 2009

A program in C language will u pls help me?

write a program to accept radius of circle and display area and perimeter





write a program to to find biggest no. among 3 no.s by using nested ternary operators

A program in C language will u pls help me?
double area=22/7*(radius)*(radius);
Reply://For circle


#include%26lt;stdio.h%26gt;





#define PI 3.142





int main()


{


float rad,peri,area;


printf("\nEnter radius = ");


scanf("%f",%26amp;rad);


peri = 2 * PI * rad;





area = PI * rad * rad;





printf("\nPerimeter = %f \n Area = %f ",peri,area);


}





//Max num





#include%26lt;stdio.h%26gt;





int main()


{


int a,b,c , biggest;


printf("\nEnter three number...");


scanf("%d%d%d",%26amp;a,%26amp;b,%26amp;c);





biggest = (a%26gt;b?a:b) %26gt; c ? (a%26gt;b?a:b) : c;





printf("\nBiggest num = %d",biggest);


}


No comments:

Post a Comment