C Program to print series 2, 4, 16,......n*n using shorthand operator and while loop


/* C Program to print series 2, 4, 16,......n*n using shorthand operator and while loop */

#include"stdio.h"

void main()
{
int num, count=1;
unsigned long int i = 2;
printf("Enter the number: ");
scanf("%d", &num);
while(count <= num)
{
printf("%lu ", i);
i *= i;
count++;
}
}

Output:



Comments

Popular Posts