Skip to content

Instantly share code, notes, and snippets.

@vikychoi
Created January 4, 2018 13:40
Show Gist options
  • Save vikychoi/a1a6194ac05b25d7904de34988fcdeee to your computer and use it in GitHub Desktop.
Save vikychoi/a1a6194ac05b25d7904de34988fcdeee to your computer and use it in GitHub Desktop.
C for power calculation
#include <stdio.h>
main()
{
printf("input x\n");
int x;
scanf("%d", &x);
printf("input y\n");
int y;
scanf("%d",&y);
int i;
int z;
z = x;
for(i = 1; i<y; i++)
{
z = z * x;
}
printf("%d", z);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment