Mr. Narayan understands that among the 10 items, the items that are referred by odd index are not available in market. Help Mr. Narayan to convert the price of all odd index item to zero (0).
#include <stdio.h>
#include <conio.h>
void main()
{
int i;
float prices[]={4,54,68,95,4,5,44,6,9,8};
for (i = 0; i < 10; i++)
{
if(i%2!=0){
prices[i]=0;
}
}
for (i = 0; i < 10; i++)
{
printf("%.2f ",prices[i]);
}
getch();
}
Comments
Leave a comment