#include<stdio.h>
void header()
{
printf("\t\t\tBuilt and Designed by Arslan Malik\n\n\n");
printf("\t\t\t www.CWorldbyAS.blogspot.com");
}
int main()
{
float a[8];
float *p;
int i;
float sum=0;
printf("\n\n\n");
header();
printf("\n\n\n\n\n");
system("pause");
system("cls");
for(i=0;i<8;i++)
{
printf("Enter %d Number : ",i+1);
scanf("%f",&a[i]);
}
system("pause");
system("cls");
p=a;
printf("\t2nd\t4th\t6th\t8th\n\n\n\n");
for(i=0;i<8;i++)
{
if(i%2==0)
printf("\t%.2f",*(p+i+1));
i++;
}
printf("\n\n\n\n\n");
system("pause");
system("cls");
p=a;
printf("\t1st\t3rd\t5th\t7th\n\n\n\n");
for(i=0;i<8;i++)
{
if(i%2==0)
printf("\t%.2f ",*(p+i));
sum=sum+*(p+i);
i++;
}
printf("\n\n\n\n\t\tSum is %.2f \n\n\n\n\n\n",sum);
}
void header()
{
printf("\t\t\tBuilt and Designed by Arslan Malik\n\n\n");
printf("\t\t\t www.CWorldbyAS.blogspot.com");
}
int main()
{
float a[8];
float *p;
int i;
float sum=0;
printf("\n\n\n");
header();
printf("\n\n\n\n\n");
system("pause");
system("cls");
for(i=0;i<8;i++)
{
printf("Enter %d Number : ",i+1);
scanf("%f",&a[i]);
}
system("pause");
system("cls");
p=a;
printf("\t2nd\t4th\t6th\t8th\n\n\n\n");
for(i=0;i<8;i++)
{
if(i%2==0)
printf("\t%.2f",*(p+i+1));
i++;
}
printf("\n\n\n\n\n");
system("pause");
system("cls");
p=a;
printf("\t1st\t3rd\t5th\t7th\n\n\n\n");
for(i=0;i<8;i++)
{
if(i%2==0)
printf("\t%.2f ",*(p+i));
sum=sum+*(p+i);
i++;
}
printf("\n\n\n\n\t\tSum is %.2f \n\n\n\n\n\n",sum);
}
No comments:
Post a Comment