Learn C Language Online
30/12/2016
QUESTION:
----------------
Area of a triangle is given by the formula
A=sqrt(S(S-a)(S-b)(S-c))
Where a, b and c are sides of the triangle and 2S=a+b+c. Write a program to compute the area of the triangle given the values of a, b and c
CODDING:
---------------
void main()
{
int a,b,c;
float S,Area;
a=b=c=S=0;
clrscr();
a=20;
b=30;
c=40;
S=(a+b+c)/2;
Area=sqrt(S*(S-a)*(S-b)*(S-c));
printf("Area of a triangle is= %f",Area);
getch();
}
OUTPUT:
-------------
Area of a triangle is= 290.473755
download C Solutions App https://goo.gl/JVY4dT
QUESTION:
-----------
Given two integers 20 and 10, write a program that uses a function add() to add these two numbers and sub() to find the difference of these two numbers and then display the sum and difference in the following form:
20 + 10 = 30
20-10 = 10
CODDING:
---------
void main()
{
clrscr();
int Sum,Diff;
printf("First Number 20\n");
printf("Second Number 10\n");
Sum=20+10;
Diff=20-10;
printf("20 + 10 = %d\n", Sum);
printf("20 -10 = %d", Diff);
getch();
}
OUTPUT:
--------
20 + 10 = 30
20 -10 = 10
Hey Friends !! Can u guess the output ???
# include
# include
void main()
{
char ch[]="I AM AN IDIOT.";
char c='A';
int i=0;
while(c)
{
c=getch();
printf("%c\a",ch[i]);
i++;
if(i==14)
{
printf(" "); i=0;
}
}
}
Click here to claim your Sponsored Listing.
Category
Contact the business
Telephone
Address
Surat
395010