The x and y values are read from the standard input. The programmust first read
ID: 3616295 • Letter: T
Question
The x and y values are read from the standard input. The programmust first read in n, then read in x values and y values. Printappropriate prompts for entering a value for n, the values for x,and the values for y.1) Print a prompt for the appropriate input values.
2) If the input value for n is not positive, an appropriate messagemust be printed, and provide a second opportunity to enter apositive number. Exit if both attempts fail.
3) And also how do I store values of x and y in two arrays?
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void main(void)
{
float x[1000]
float y[1000]
int n;
scanf("%f", &x);
scanf("%f", &y);
printf("Enter a positive integer:");
scanf("%d", &n);
if(n <= 0)
{
printf(" Input must be positive ");
exit(0);
}
This is what I have so far but I don't know how
to prompt for a second opportunity to
enter a positive number. As in do I just type in
printf("Please try again to enter a positive number:");
under the first prompt?
Also did I correctly read "n" real numbers for x and y
or is that the wrong place to put it?
Plus I don't know how to store x and y in two arrays
Explanation / Answer
please rate - thanks #include #include int main() {int n,i; float x[20],y[20]; printf("How many sets of values do you have? "); scanf("%d",&n); if(nRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.