1 solutions

  • 1
    @ 2025-3-29 15:08:40
    #include<bits/stdc++.h>
    using namespace std;
    int digit(int n,int k)
    {
    	int c=n; 
    	int a=0;
    	while(c!=0)
    	{
    		a++;
    		int g=c%10;
    		c/=10;
    		if(a==k)
    		{
    			return g;
    		}
    	}
    }
    int main()
    {
    	int n,k;
    	cin>>n>>k;
    	int b=digit(n,k);
    	cout<<b; 
    	return 0;
    }

    Information

    ID
    933
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    19
    Accepted
    12
    Uploaded By