Thursday, 9 February 2017

Geeksforgeeks Solution For " 12 hour clock subtraction "

GeeksforGeeks Solution For School Domain .Below You Can Find The Solution Of Basic ,Easy ,Medium ,Hard .You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers 

Problem :- Given two positive integers num1 and num2, subtract num2 from num1 on a 12 hour clock rather than a number line.

Submit Your Solution :- Click Here 


Solution :-

#include <iostream>
using namespace std;

int main() 
{
int t;
cin>>t;
while(t--)
{
   int n1,n2,c,m;
   cin>>n1>>n2;
   c=n1-n2;
   m=c%12;
   cout<<m<<endl;
}
return 0;

}


Output:-

Geeksforgeeks Solution For " 12 hour clock subtraction "

No comments:
Write comments

Recommended Posts × +