Advertisement
RieqyNS13

Untitled

Oct 25th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. using namespace std;
  5. int main(){
  6.     char b[13], *tmp;
  7.     int len, count=0;
  8.     for(int a=1; a<=100; a++){
  9.         itoa(a, b, 10);
  10.         len=strlen(b);
  11.         for(int c=0; c<len; c++){
  12.             tmp=b[c];
  13.             if(!strcmp(tmp, "5"))count++;
  14.             }
  15.     }
  16.     cout<<count;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement