A girl counting on her left hand’s fingers, u need to tell on which finger she will stop for a giving number. Counting was like 1-thumb, 2-index finger , 3-middle finger, 4-ring finger,5-little finger then 6-ring, 7-middle , 8-index, 9 thumb , 10 -index and so on


#include<iostream>
#include<cstring>
using namespace std;
int main(){
string hand[]={"thumb","Index","Middle","Ring","Little"};
int n;
cin>>n;
if(n<=0) return 0;
if(n>5){
n=n-5;
int i=n/4;
int k=n%4;
if(i%2==0){
cout<<hand[4-k];
}else{
cout<<hand[k];
}
}else
{
cout<<hand[n-1];
}
}

Comments

Popular posts from this blog