BITFRENZY

a blog dedicated to technology and programming to shape nation's future.

Breaking

Post Top Ad

Friday, May 17, 2019

Viral Advertising Hackerrank solution in c

#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
int sum,k,d=0;
int p=5;
for(int i=1;i<=n;i++)
{
d=p;
k=d/2;
p=k*3;
sum=sum+k;
}
printf("%d",sum);
return 0;
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages