Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- void main(){
- int numbers, num[10], count, i, j, temp, locate, mid;
- printf("Enter how many numbers to be inputted: ");
- scanf("%d",&count);
- for(i=0;i<=count-1;i++){
- printf("Enter a number: ");
- scanf("%d",&num[i]);
- }
- for(i=0;i<=count-1;i++){
- for(j=0;j<=count-1;j++){
- if(num[j]>num[j+1]){
- temp=num[j];
- num[j]=num[j+1];
- num[j+1]=temp;
- }
- }
- }
- mid = count/2
- printf("Number to locate: ");
- scanf("%d",&locate);
- if(locate==num[mid]){
- printf("The number has been found");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement