4) Write a program that takes a 5 digit number and
calculates 2 power
that number and prints it.
I did the following program and is this correct
Answer / renu gaindar
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void main()
{
int a[5],b[5],c[2],j[2],d[2];
int d,e,f,g,h,i,l,result;
char first[10], secont[10],third[10],forth[10],fifth
[10],x[20];
printf("\nEnter 5 digit number : ");
for(i=1,i<=5;i++)
{
scanf("%d",a[i]);
}
c=a[5]*a[5]; //multiplication of units place
d[1]=c[1]; //1st carry
e=c[0]; //First Digit
c=a[4]*a[4];
d[1]=c+d;
f=c[0];
c=(a[3]*a[3]);
d[1]=c+d;
g=c[0];
c=(a[2]*a[2]);
d[1]=c+d;
h=c[0];
c=(a[1]*a[1]);
d[1]=c+d;
l=c[0];
atoi(e,first,10);
atoi(f,second,10);
atoi(g,third,10);
atoi(h,forth,10);
atoi(l,fifth,10);
strcpy(x,first);
strcpy(x,second);
strcpy(x,third);
strcpy(x,forth);
strcpy(x,fifth);
result=atoi(x);
printf("%d",result);
}
| Is This Answer Correct ? | 1 Yes | 0 No |
What kind of question can be asked at the time of Interview for State Bank Of India Clerical Interview
21. Find d Odd one out? a. LINUX b. WINDOWS 98 c. SOLARIS d. SMTP b. JAVA b. LISP c. Small talk d. Eiffel c. HTTP b. ARP c. SMTP d. SAP d. Linux b.windows NT c. SQL server d. UNIX e. SAP b. ARP c. WAP d.TCP IP f. Oracle b. Linux c. Ingress d. DB2 g. SMTP b. WAP c. SAP d. ARP h. WAP b. HTTP c. BAAN d. ARP i. SQL b. DB2 c. SYBASE d. HTTP
how configur net and vpn on cisco product
if the bit string 0111101111101111110 is bit stuffed,what is the output string?
how to calculate when (-) sign givcn in the power number for example 125^-5
WHAT IS THE MEANING OF FLASHING VD AND FD INSTALLATION PLENIUM BOXES IN CENTRAL AIR CONDITION
model question papers of GrayOrange company
how to create user name stape by stape in cisco router {with command}
how is the config take place and from reciever side how will process the data into internal table
how much lighting lux need for a common walking area at night time
What suggestions would you give to include quality, as well as, the production capability into design?
3. Tell me about a time when you had too many things to do and you were required to prioritize your tasks.
Civil Engineering (5086)
Mechanical Engineering (4453)
Electrical Engineering (16638)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)