Answer to Question #185508 in C for Woyengimiesindo Malati

Question #185508

Write a function that reads real (fractional) numbers, 𝑥1, 𝑥2, … , 𝑥𝑁 from the keyboard 

into an array of N, starting from index 0. The numbers are read after a prompt.



1
Expert's answer
2021-04-30T05:39:02-0400
#define NO_OF_DATA	500


main(void)
{
	int n,l;
	float InputData[NO_OF_DATA];
	printf("\nEnter the no. of data to be entered: "); scanf("%d",&l);
	for(n=0;n<l;n++)
	{
		printf("\nEnter Data No. %d : ",n+1); scanf("%f",&InputData[n]);
	}
	printf("\n\nEntered Data: ");
	for(n=0;n<l;n++) printf("%.2f, ",InputData[n]);	
	return(0);
}

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