wwrite a program to enter number of digits and form a number using these digits.
#include<stdio.h>
#include<math.h>
int main()
{
int n,i,a[10],s=0;
printf("enter the no of digit ");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("enter the %d th digit ",i);
scanf("%d",&a[i]);
}
i=0;
while(i<n)
{
s=s+a[i]*pow(10,i);
i++;
}
printf("the no is %d",s);
return 0;
}
Comments
Post a Comment