Its a program to convert integer stored in a string into an int. Please help.
#include<stdio.h>
#include<math.h>
int main()
{
int num, n, i;
num = 0;
printf("Enter n\n");
scanf("%d", &n);
char string[n+1];
printf("Enter the number\n");
scanf("%s", &string);
for(i=0;string[i]!='\0';i++)
{
num = num + string[i]*pow(10,n-i-1);
}
printf("The required number is %d", num);
return 0;
}