Code:
#include <stdio.h>
#include <conio.h>
void main()
{
float ar[10]={1.1};
double ray[10]={9.29};
float *x;
double *y;
int a;
x=&ar[0];
y=&ray[0];
float a,b;
int ctr;
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;
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;
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;
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;
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;
ct:
printf("Main Menu\n");
printf("\n\n1)Program that declares one float variable and one double data type variable");
printf("\n 2)");
printf("\n 3)");
printf("\n 4)Compute the sum and average of the elements of the array");
printf("\n 5)Initialize the array, set a pointer that points to the first, and print all the elements of the array from the first down to the last");
printf("\n 6)Double data type accessing the array elements");
printf("\n 7)Initialize the array, set a pointer that points to the last, and print all the elements of the array from the first down to the last");
printf("\n 8)with 10 double data type elements");
printf("\n 9)Exit");
printf("Enter your choice");
scanf("%d",&option);
if(option==1)
printf("\nthe value of float is: %.2f",*x++);
printf("\n");
printf("\nthe value of double is: %.2lf",*y++);
else if(option==2)
void floating(float arr[],float *ave, float *sum)
{
for(ctr=0;ctr<=10;ctr++)
{
a+=arr[ctr];
}
b=a/10;
*sum=a;
*ave=b;
}
{
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);
else if(option==3)
{
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++);
}
else if(option==4)
{
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++);
}
else if(option==5
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--);
}
else if(option==6)
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--);
else if(option==7)
exit();
else
go to ct;
}
I know its crazy but I don't have any option.. I got mental blocked.. ='(