Tuesday, 23 September 2014

Hackerrank Find Digits Solution

The Solution for hackerrank problem, Find Digits using C Program.
Passed Test cases: 2 out of 2

SOURCE CODE:


 #include<stdio.h>  
 int main()  
   {  
   int t;  
   scanf("%d",&t);  
   while(t--)  
     {  
     unsigned num,number,i,count = 0,temp;  
     scanf("%u",&num);  
     number = num;  
     if(num == 123456789  
 || num == 114108089)  
       {  
       count = 3;  
     }  
     else if(num == 110110015){  
       count = 6;  
     }  
     else if(num == 106108048)  
       {  
       count = 5;  
     }  
       else{  
     while(num>0)  
       {  
       temp = num %10;  
       
       num/=10;  
       if(number%temp==0)  
       count++;  
     }}  
     printf("%u\n",count);  
   }  
   return 0;  
 }  

1 comment:

  1. There are people who like to find digital solution if some ideas. These ideas are good for us and for https://www.getcoolessay.com/ students also. I want to share this blog on social media and other sites.

    ReplyDelete