Question #292473

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).


Expert's answer

#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();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS