Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

PROBLEM STATEMENT

The following offsets are taken from a chain line to an irregular boundary towards right
side of the chain line.
Chainage 0

25

50

75

100

125

150

Offset
m

5.0

6.5

5.5

7.3

6.0

4.0

3.6

Compye the total area enclosed irregular boundary and the chain line using
a) Trapezoidal Rule
b) Simpsons 1/3 Rule
c) Simpsons 3/8 Rule

8
7
6

OFFSET (m)

5
4
3
2
1
0
0

25

50

75
CHAINAGE (m)

100

125

150

TRAPEZOIDAL RULE
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float x[10],y[10],sum=0,h,temp;
int i,n,j,k=0;
float fact(int);
printf(" \t \t \t TRAPEZOIDAL RULE");
printf("\n \n Enter the number of observations: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n Enter the value of chainage %d: ",i);
scanf("%f",&x[i]);
printf("\n\ Enter the value of offset %d im metres : ",i);
scanf("%f",&y[i]);
}
h=x[1]-x[0];
n=n-1;
for(i=0;i<n;i++)
{
if(k==0)
{
sum = sum + y[i];
k=1;
}

else
sum = sum + 2 * y[i];
}
sum = sum + y[i];
sum = sum * (h/2);
printf("\n \t ENCLOSED AREA = %f square metres ",sum);
getch();
}

SIMPSONS 1/3 RULE


#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float x[10],y[10],sum=0,h,temp;
int i,n,j,k=0;
float fact(int);
printf("\t \t \t \t SIMPSON'S 1/3 RULE");
printf("\n \n Enter number of obseervations: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n\ Enter the value of chainage %d: ",i);
scanf("%f",&x[i]);
printf("\n\ Enter the value of offset %d im metres : ",i);
scanf("%f",&y[i]);
}
h=x[1]-x[0];
n=n-1;
sum = sum + y[0];
for(i=1;i<n;i++)
{
if(k==0)
{

sum = sum + 4 * y[i];


k=1;
}
else
{
sum = sum + 2 * y[i];
k=0;
}
}
sum = sum + y[i];
sum = sum * (h/3);
printf("\n\n \t AREA ENCLOSED = %f square metres ",sum);
getch();
}

SIMPSONS 3/8 RULE


#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
float x[10],y[10],sum=0,h,temp;
int i,n,j,k=0;
float fact(int);
printf("\t \t \t \t SIMPSON'S 3/8 RULE");
printf("\n \n Enter number of obseervations: ");
scanf("%d",&n);
for(i=0; i<n; i++)
{
printf("\n\ Enter the value of chainage %d: ",i);
scanf("%f",&x[i]);
printf("\n\ Enter the value of offset %d im metres : ",i);
scanf("%f",&y[i]);
}
h=x[1]-x[0];
n=n-1;
sum = sum + y[0];
for(i=1;i<n;i++)
{
if(i%3==0)
{
sum = sum + 2 * y[i];
}

else
{
sum = sum + 3 * y[i];
}
}
sum = sum + y[i];
sum = sum * (3*h/8);
printf("\n\n \t AREA ENCLOSED = %f square metres ",sum);
getch();
}

You might also like