You do not have permission to view the full content of this post.
Log in or register now. <stdlib.h>
You do not have permission to view the full content of this post. Log in or register now.<stdio.h>
int main ()
{ srand(time(NULL));
int array[10];
for(int init=0;init<10; init++){
array[init] = (rand() % 20) + 1;
} printf("Array values: ");
for(int i=0;i<10; i++){
printf("%d ", array);
} printf("\n\n");
//your code here}
Example 1:
Array values: 2 4 1 3 4 12 16 10 9 18
Sorted: 1 2 3 4 4 9 10 12 16 18
Example 2:
Array values: 5 1 3 4 12 11 19 18 9 6
Sorted: 1 3 4 5 6 9 11 12 18 19
My coding:
#include <stdlib.h>
#include<stdio.h>
int main () {
srand(time(NULL));
int array[10];
for(int init=0;init<10; init++){
array[init] = (rand() % 20) + 1;
}
printf("Array values: ");
for(int i=0;i<10; i++){
printf("%d ", array);
}
printf("\n\n");
int i;
printf("Number to search for:");
scanf("%d",&array);
if(i<=array){
printf("Result: Number exists in array");
}else{
printf("Result: Number does not exist in array");
}
}
help me....
You do not have permission to view the full content of this post. Log in or register now.<stdio.h>
int main ()
{ srand(time(NULL));
int array[10];
for(int init=0;init<10; init++){
array[init] = (rand() % 20) + 1;
} printf("Array values: ");
for(int i=0;i<10; i++){
printf("%d ", array);
} printf("\n\n");
//your code here}
Example 1:
Array values: 2 4 1 3 4 12 16 10 9 18
Sorted: 1 2 3 4 4 9 10 12 16 18
Example 2:
Array values: 5 1 3 4 12 11 19 18 9 6
Sorted: 1 3 4 5 6 9 11 12 18 19
My coding:
#include <stdlib.h>
#include<stdio.h>
int main () {
srand(time(NULL));
int array[10];
for(int init=0;init<10; init++){
array[init] = (rand() % 20) + 1;
}
printf("Array values: ");
for(int i=0;i<10; i++){
printf("%d ", array);
}
printf("\n\n");
int i;
printf("Number to search for:");
scanf("%d",&array);
if(i<=array){
printf("Result: Number exists in array");
}else{
printf("Result: Number does not exist in array");
}
}
help me....
Last edited: