Answer to Question #292473 in C for Pacan

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


1
Expert's answer
2022-02-01T14:18:32-0500
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS