Update

One new tab added. Open in browser view if it is not visible. (25/08/2022 08:48)

Odd Pairs

Problem Code:
ODDPAIRS

Contest Code:START53D
Submission byrashmi1729
Submitted: 12 hours ago

Status:
Correct Answer

Language : C
(NOTE : Try a few times yourself before moving to the solution)


#include <stdio.h>

int main(void) {
	int t;
	scanf("%d\n",&t);
	while(t--)
	{
	    long long int n;
	    scanf("%lld\n",&n);
	    long long int ans = (n*(n+1)/2) - ((n+1)/2);
	    printf("%lld\n",ans);
	}
	return 0;
}



No comments: