Advertisement
skb50bd

Repeated Char

Apr 4th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n, a[128]={0}, i;
  5.     printf("Enter Message: ");
  6.     for(n=0 ; n!='\n' ;)
  7.     {
  8.         scanf("%c",&n);
  9.         for(i=0 ; i<128 ; i++)
  10.             if(n==i)
  11.                 a[i]++;
  12.     }
  13.     for(i=0 ; i<128 ; i++)
  14.         if(a[i]>1)
  15.             printf("%c: %d times\n",i,a[i]);
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement