Sunday, November 12, 2017

Find Remainder Codechef Problem Solution In (C++,C#)

https://www.codechef.com/problems/FLOW002


In C++.......

#include <bits/stdc++.h>

using namespace std;


int main()
{

    int t,a,b;
    cin>>t;
    while(t--)
    {
        cin>>a>>b;
        cout<<a%b<<endl;
    }

    return 0;
}



In C#  ............

using System;



    public class Program
    {
      
        public static void Main()

        {
            int T = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < T;i++ )
            {
                string s = Console.ReadLine();
                string[] values = s.Split(' ');
                int a = int.Parse(values[0]);
                int b = int.Parse(values[1]);
                Console.WriteLine(a % b);
               }
           
               
        }

    }
   

No comments:

Post a Comment