Pascal's Triangle
Limits
1s, 512 MB
Given an integer N, print the sum of the Nth row of the Pascal’s triangle.
In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. Below are the first few rows of the Pascal’s triangle:
The sum of the 5th row, for example, is .
In mathematics, Pascal’s triangle is a triangular array of the binomial coefficients. Below are the first few rows of the Pascal’s triangle:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
The numbers on the edges of the triangle are always 1.
Each of the remaining numbers are the sum of the two numbers that appear
immediately above it.The sum of the 5th row, for example, is .
Input
The input will contain one integer N (0 < N < 30).
Output
Print the sum of the Nth row of Pascal’s triangle.
#include<stdio.h>
#include<math.h>
int main()
{
int n,sum;
scanf("%d", &n);
sum=pow(2,n-1);
printf("%d", sum);
}