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 :- You are given a positive integer N and you have to find the number of non negative integral solutions to a + b + c = N.
Submit Your Solution :- Click Here
Solution :-
#include <iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,n1,n2,i;
cin>>n;
n1=n+2;
n2=(n1*(n1-1))/2;
cout<<n2<<endl;
}
return 0;
}
Output:-
0 Comments: