program to arrange Randomly entered numbers in serial wise using c programming language.
#include<stdio.h>
int main(){
int userInput[100];
int num, max = 0;
int count = 0;
do{
printf("enter a number:");
scanf("%d",&num);
userInput[count] = num;
if(num > max){
max = num;
}
count++;
}while(num != 0);
printf("serial wise.\n");
for(int i = 1; i <= max; i++){
for(int j = 0; j < count; j++){
if(userInput[j] == i){
printf("%d ", userInput[j]);
break;
}
}
}
}
Comments
Post a Comment