Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- //#include <testing.h>
- int main(void) {
- int M;
- int A[20];
- int temp;
- int j=0;
- scanf("%d\n", &M);
- if (M > 20 || M < 2)
- {
- //WAIT_ANY_KEY
- return 0;
- }
- for (int i=0; i<M; i++)
- {
- scanf("%d", &temp);
- if (temp <= 1000 && temp >= -1000)
- {
- if(((temp > A[j-1])) && (i > 0))
- {
- A[j]=temp;
- j++;
- }
- else
- {
- if(i==0)
- {
- A[i]=temp;
- j++;
- }
- }
- }
- else
- {
- // WAIT_ANY_KEY
- return 0;
- }
- }
- for (int k = 0; k < j; k++)
- {
- for(int z=0; z<=k; z++)
- {
- printf("%d ",A[z]);
- }
- printf("\n");
- }
- //WAIT_ANY_KEY
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement