Find Digits

 Question :-

https://www.hackerrank.com/challenges/find-digits/problem

Solution in C language :-

#include<stdio.h>
int main(){

    int n;
    scanf("%d",&n);
    int a[n],i;
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int t,temp,c=0;
    for(i=0;i<n;i++){
        t=a[i];
        do{
        temp=t%10;
        if(temp==0){
            c=c;
        }
        else{
        if(a[i]%temp==0){
            c++;
        }
        }
        t=t/10;
        }while(t!=0);
        printf("%d\n",c);
        c=0;
    }
    

    return 0;
}

Comments

Popular posts from this blog

Sherlock and Squares

Cut The Sticks

Home