J
John
Hi all,
I got totally confusion on the following code:
#include <stdio.h>
#define MAX 1000
main()
{
int n, a[MAX], i, j;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a);
/* find the index j here */
printf("%d\n", j);
}
I want to get the following outputs:
For example:
5 3 2 1 4 5
3
or:
6 6 3 1 4 2 5
5
or:
4 3 2 1 4
3
or"
10 10 9 8 7 6 5 4 3 2 1
10
In fact, I am going to solve this problem by the
follow-up code,but it has some mistake.
-----------------------------------------------------
The Problem says:
[Write a C program that reads the number of data "n" and
the data themselves "d1", "d2", ...,"dn" from the keyboard
and stores them into an array.
Then it finds the index "j"that satisfies the inequations:
d(j-1) > dj < d(j+1) < ... < d(n-1) < dn
and reports "j".]
----------------------------------------------------------
So,If you know the proper way to pay for this solutions,
please show them with kindness.
Tanx in advance!
John
I got totally confusion on the following code:
#include <stdio.h>
#define MAX 1000
main()
{
int n, a[MAX], i, j;
scanf("%d", &n);
for (i = 0; i < n; i++)
scanf("%d", &a);
/* find the index j here */
printf("%d\n", j);
}
I want to get the following outputs:
For example:
5 3 2 1 4 5
3
or:
6 6 3 1 4 2 5
5
or:
4 3 2 1 4
3
or"
10 10 9 8 7 6 5 4 3 2 1
10
In fact, I am going to solve this problem by the
follow-up code,but it has some mistake.
-----------------------------------------------------
The Problem says:
[Write a C program that reads the number of data "n" and
the data themselves "d1", "d2", ...,"dn" from the keyboard
and stores them into an array.
Then it finds the index "j"that satisfies the inequations:
d(j-1) > dj < d(j+1) < ... < d(n-1) < dn
and reports "j".]
----------------------------------------------------------
So,If you know the proper way to pay for this solutions,
please show them with kindness.
Tanx in advance!
John