4) Write a program that takes a 5 digit number and
calculates 2 power
that number and prints it.
i have done maximum par but i m findind problem in the
commented area.
please help...

Answer Posted / renugaindar

#include<stdlib.h>
#include<conio.h>
#include<stdio.h>
void main()
{
int j,i,k,d=0,n=0,e=0,c=0,y=0,l=0,f=0,b
[10],result,w;
int a[10],r[10],x[10],m;
char first[10],second[10],third[10],forth[10],fifth
[10],sixth[10];
clrscr();
for(i=0;i<5;i++)
{
printf("\n\t\tEnter %d element : ",i+1);
scanf("%d",&a[i]);
}
for(i=4;i>=0;i--)
{
printf("\n\n\t\t");
for(j=4;j>=0;j--)
{
c=a[i]*a[j];
d=c+f;
e=d%10;
f=d/10;
b[j]=e;
printf("\n\t\t Value of %d in B %
d== %d",i,j,b[j]);
if(j==0)
{
itoa(f,second,10);
itoa(b[0],first,10);
itoa(b[1],third,10);
itoa(b[2],forth,10);
itoa(b[3],fifth,10);
itoa(b[4],sixth,10);
strcpy(x,second);
strcat(x,first);
strcat(x,third);
strcat(x,forth);
strcat(x,fifth);
strcat(x,sixth);
result=atoi(x);
printf("\n\t\tresult: %
s",x);
/* for(l=0;l<6;l++)
{
w=atoi(x[l]);
r[l]=w;
printf
("\n\t\tResult %d == %s --%d",i,x,r[l]);
}*/

}
}
n++;
}
for(k=n;k>=0;k--)
{
if(k==3)
{
itoa(r[k],third,10);
itoa(0,forth,10);
strcpy(y,third);
strcat(y,forth);
for(l=9;l<=0;l--)
{
m=atoi(x);
printf("\n\n\t\t adding 0
in %s",x);
}
}
n--;
}

getch();
}

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a pointer on a pointer in c programming language?

621


write a program to print largest number of each row of a 2D array

1873


How do I read the arrow keys? What about function keys?

616


What is context in c?

542


Is a house a shell structure?

697






please explain every phase in the "SDLC" in the dotnet.

2180


What is the newline escape sequence?

589


Tell me what is null pointer in c?

616


Define C in your own Language.

642


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

809


How can a number be converted to a string?

608


What is array of structure in c programming?

756


How can I get the current date or time of day in a c program?

652


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1122


Did c have any year 2000 problems?

658