Sir Loko,
Woah! It had worked quitely..
Code:
#include <stdio.h>
#include <conio.h>
int main() {
int x, tmp, num[5] = {0};
clrscr();
//initializing data
for(x = 0; x <= 4; x++) {
printf("Enter num%d: ", x+1);
scanf("%d", &tmp);
num[tmp-1]++; // Increment index for 3.
}
printf("\n");
//printing output..
for( x = 0; x <= 4; x++ ){
if( num[x] > 0 )
printf("Number %d appeared %dx\n", x + 1, num[x]);
}
getch();
return 0;
}
How come I didn't think of using the memory locator of the scanf as the index of my array... perhaps I'm only a newbie C enthusiast...lolz
I, however, am thanking you sir for your effort in giving me a simple code..