Code:
Program1
#include <stdio.h>
#include <conio.h>
void main()
{
float ar[10]={1.1};
double ray[10]={9.29};
float *x;
double *y;
int a;
clrscr();
x=&ar[0];
y=&ray[0];
printf("\nthe value of float is: %.2f",*x++);
printf("\n");
printf("\nthe value of double is: %.2lf",*y++);
getch();
}
Program2
#include<stdio.h>
#include<conio.h>
void floating(float arr[],float *ave, float *sum)
{
float a,b;
int ctr;
for(ctr=0;ctr<=10;ctr++)
{
a+=arr[ctr];
}
b=a/10;
*sum=a;
*ave=b;
}
void main()
{
float arr[10]={1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0};
float sum;
float ave;
int ctr;
clrscr();
for(ctr=0;ctr<=10;ctr++);
{
arr[ctr];
}
floating( arr,&ave,&sum );
printf("\n the average is : %.2f",ave);
printf("\n the sum is : %.2f",sum);
getch();
}
Program3
#include<stdio.h>
#include<conio.h>
void main()
{
float arr[10]={1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0};
float *pf;
int ctr;
clrscr();
for(ctr=0;ctr<=9;ctr++)
{
printf("\nthe array list [%d]: %.2f",ctr , arr[ctr]);
}
printf("\n");
pf=&arr[0];
for(ctr=0;ctr<=9;ctr++)
{
printf("\n elemnts of the array first to the last: %.1f",*pf++);
}
getch();
}
Program4
#include<stdio.h>
#include<conio.h>
void main()
{
double arr[10]={1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0};
double *pf;
int ctr;
clrscr();
for(ctr=0;ctr<=9;ctr++)
{
printf("\nthe array list [%d]: %.2lf",ctr, arr[ctr]);
}
printf("\n");
pf=&arr[0];
for(ctr=0;ctr<=9;ctr++)
{
printf("\n elemnts of the array first to the last: %lf",*pf++);
}
getch();
}
Program5
#include<stdio.h>
#include<conio.h>
void main()
{
float arr[10]={1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0};
float *pf;
int ctr;
clrscr();
for(ctr=0;ctr<=9;ctr++)
{
printf("\nthe array list [%d]: %.2f",ctr , arr[ctr]);
}
printf("\n");
pf=&arr[9];
for(ctr=0;ctr<=9;ctr++)
{
printf("\n elemnts of the array last to first: %.1f",*pf--);
}
getch();
}
Program6
#include<stdio.h>
#include<conio.h>
void main()
{
double arr[10]={1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2.0};
double *pf;
int ctr;
clrscr();
for(ctr=0;ctr<=9;ctr++)
{
printf("\nthe array list [%d]: %.2lf",ctr , arr[ctr]);
}
printf("\n");
pf=&arr[9];
for(ctr=0;ctr<=9;ctr++)
{
printf("\n elemnts of the array last to first: %.2lf",*pf--);
}
getch();
}