Maths File PDF
Maths File PDF
Maths File PDF
ANSWER:
#include<stdio.h> int
main()
{
int num=5,i,sum=0,mean; int
a[]={15,10,25,35,20};
for ( i = 0; i <=num ; i++)
{
sum=sum+a[i];
}
mean=sum/5;
printf("The mean is => %d",mean);
return 0;
}
1
QUESTION: FIND THE MEAN OF THE DATA ENTERED BY THE
USER?
ANSWER:
#include<stdio.h>
int main()
int num=5,i;
float sum=0,mean,a[10];
scanf("%d",&num);
scanf("%f",&a[i]);
sum=sum+a[i];
mean=sum/num;
return 0;
2
QUESTION: WRITE A PROGRAM TO FIND THE MODE OF THE DATA?
ANSWER:
#include<stdio.h>
int maxValue=0,maxCount=0,i,j;
int count=0;
if (a[j]==a[i])
++count;
if (count> maxCount)
maxCount=count;
maxValue=a[i];
return maxValue;
int main()
int n=5;
int a[]={0,6,7,2,7};
return 0;
} 3
4
QUESTION:FIND THE MODE OF THE DATA ENTERED BY THE USER?
ANSWER:
#include<stdio.h>
int maxValue=0,maxCount=0,i,j;
int count=0;
if (a[j]==a[i])
++count;
if (count> maxCount)
maxCount=count;
maxValue=a[i];
return maxValue;
int main()
int n,i,a[50];
scanf("%d",&n);
for(i=0;i<n;i++)
return 0;
6
QUESTION:FIND MEDIAN OF THE ENTERED DATA?
ANSWER:
#include <stdio.h>
int t;
t = *p;
*p = *q;
*q = t;
int i, j, temp;
int main()
int a[]={6,3,8,5,1};
int n=5;
int sum,i;
sort(a,n);
n=(n+1)/2-1; 7
printf("Median is = %d",a[n]);
return 0;
8
QUESTION:FIND THE MEDIAN OF THE DATA ENTERED BY THE USER?
ANSWER:
#include <stdio.h>
int t;
t = *p;
*p = *q;
*q = t;
int i, j, temp;
int main()
int a[50];
int n;
int sum, i;
scanf("%d", &n); 9
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
sort(a, n);
n = (n + 1) / 2 - 1;
return 0;
10
QUESTION:FIND THE VARIANCE AND STANDARD DEVIATION OF THE USER’S ENTERED DATA?
ANSWER:
#include<stdio.h>
#include<math.h>
float mean,variance,sd,sum=0,varsum=0;
int i;
sum=sum+price[i];
mean=sum/(float)number;
varsum=varsum+pow((price[i]-mean),2);
variance=varsum/(float)number;
sd=sqrt(variance);
return sd;
int main()
float price[]={5,15,25,35,45,55};
float SD;
int i,Number=6;
SD=Standard_Deviation(price,Number);
return 0; 11
}
12
QUESTION: WRITE A PROGRAM TO FIND THE MEDIAN FOR CONTINUOUS
SERIES?
ANSWER:
#include<stdio.h>
int i,j,ll,up,cl,nc,l[100],u[100],f[100],sf,am,cf[100],temp,x[100];
void continuous()
scanf("%d",&ll);
scanf("%d",&cl);
scanf("%d",&nc);
up=ll+cl;
l[i]=ll;
u[i]=up;
ll=up;
x[i]=((float)l[i]+(float)u[i]/2);
printf("\n");
scanf("%d",&f[i]);
cf[0]=f[0]; 13
for ( i = 0; i < nc; i++)
cf[i+1]=cf[i]+f[i+1];
sf+=f[i];
if (sf/2>=cf[i])
temp=i+1;
printf("\n%d-%d\t%d\t%d",l[i],u[i],f[i],cf[i]); printf("\
nTotal :\t%d",sf);
int main()
{ 14
continuous();
return 0;
15
QUESTION:WRITE A PROGRAM TO CALCULATE THE QUARTILE OF DISCRETE
SERIES?
ANSWER:
#include <stdio.h>
int main()
scanf("%d", &n);
scanf("%d", &x[i]);
scanf("%d", &f[i]);
sort[i] = f[i];
cf[0] = f[0];
// exchange them
temp = sort[i];
sort[i] = sort[j];
sort[j] = temp;
printf("%d", sort[i]);
return 0;
17
18
PRACTICAL FILE
GOVT.COLLEGE.DAULATPUR.CHOWK,UNA.HIMACHAL PRADESH
NAME:.…………………………………………………………CLASS:……………………………………………………
TEACHER’S SIGNATURE:…………………………………………………………….