Showing posts with label Area Of Traingle Using Float Variable. Show all posts
Showing posts with label Area Of Traingle Using Float Variable. Show all posts

Friday, 26 October 2012

Program Of Data Entry Or Add Records Using C

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

char name[40];
 

int age;
 

float bs;
 

};
 

main()
 

{
 

clrscr();
 

FILE *fp;
 
struct emp e;
 
char s[80];
 
char another='y';
 
if(fp==NULL)
 
{
 
printf("Can't Open File");
 
exit(1);
 
}
 
printf("\n File  TEXT Is=");
 
printf("\n");
 
printf("\n Enter Name,AGE,Basic salary");
 
scanf("%s",e.name);
 
scanf("%d",&e.age);
 
scanf("%f",&e.bs);
 
printf("Add Another Record(y/n)");
 
another=getche();
 
}
 
fclose(fp);
 
getch();
 
}

Wednesday, 18 January 2012

Program To Find Area Of Traingle Using Float Variable


#include<iostream.h>
#include<conio.h>
#include<math.h>
float sum(float x,float y,float z);
main()
{
clrscr();
float a,b,c,s,p;
cout<<"Enter the FIRST Number=";
cin>>a;
cout<<"Enter the SECOND Number=";
cin>>b;
cout<<"Enter the THIRD Number=";
cin>>c;
s=sum(a,b,c);
cout<<"AREA OF TRANGLE IS THE RESULT="<<s;
getch();
 }
float sum(float x,float y,float z)
{
float w,t;
w=(x+y+z)/2;
t=sqrt(w*(w-x)*(w-y)*(w-z));
return w,t;
}