OCCURANCE COUNTER
Code :
#include<stdio.h>
int main()
{
int n, seq, freq=0;
printf("===================================\n");
printf("\tOCCURANCE COUNTER\n");
printf("===================================\n");
printf("Enter a number : ");
scanf("%d", &n);
printf("\nEnter sequence of numbers\n(Terminated by -1) : ");
while(seq != -1)
{
scanf("%d", &seq);
if(seq == -1)
{
break;
}
if(seq == n)
{
freq++;
}
}
printf("\n-----------------------------------\n");
printf(" No of Occurance of %d = %d\n", n, freq);
printf("-----------------------------------\n");
return 0;
}
Come again Learn again !
« iCodeBuzz »
No comments:
Post a Comment