View Code of Problem 60

#include <stdio.h>
#include <math.h>
int main(){
	int n,temp,i,j;
	temp=0;
	int a[100],b[100];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	} 
	for(i=0;i<n;i++,temp=0)
	{
		for(j=0;j<a[i];j++)
		{
			temp+=j;
		}
		b[i]=pow(2,a[i])-temp;
		printf("Scenario #%d:\n",i+1);
		printf("%d:\n",b[i]);
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 60