GeeksforGeeks Solution For Hard Domain .Below You Can Find The Solution Of School Basic ,Easy ,Medium . Or Hackerrank Solution You Can Also Direct Submit Your Solution to Geeksforgeeks Same Problem .You Need to login then you can submit you answers
Problem :- Number of ways to find two numbers
Submit Your Solution :- Click Here
Solution :-
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int i,j,k,sum=0;
cin>>k;
for(i=1;i<1000;i++)
{
for(j=i+1;j<1000;j++)
{
if((i+j)<=k)
{
sum++;
}
}
}
cout<<sum<<endl;
}
return 0;
}
Output:-
0 Comments: