Codechef : Problem name " Minimum Coins" solution in C#

 ============================Solution==========================

using System;

public class Test

{

public static void Main()

{

    int t=Convert.ToInt32(Console.ReadLine());

for(int i=0;i<t;i++){    

    int X=Convert.ToInt32(Console.ReadLine());

    int coins=X%10;

        Console.WriteLine(coins);     

}

}

}

======================Explanation============================
We have coins of 1 rupee each and notes of denomination 10
So if we have 45 rupees then 40 rupees will be of 10 rupee note and remaining we have 5 coins of 1 rupee each
so we have used remainder operator so than remainder will denote the amount of coin is required.

Comments