Arithmetic Progression - Nth Term

C CODE:

#include<stdio.h>
#include <stdlib.h>

int main()
{
int a,b,c,d,i,n,j;
scanf("%d %d %d",&a,&b,&c);
scanf("%d",&n);
d=b-a;
i=a+(n-1)*d;
printf("%d",i);
}

Comments

Popular posts from this blog

Reverse String Till Underscore

Count of common characters in two strings

RECTANGULAR SUM