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 |
Why Ammeter is always connected in series in the circuit and Voltmeter in parallel?
14 Answers BEL, College School Exams Tests, DRDO, Electrical Tech, UOB,
WHAT IS THE PROPER LOCATION OF SAMPLE POINT OF LPG SPHERE TANK?
good morning! can u briefly explain the concept of syllolism and wat it mean?
Apply Newton?s method to compute the approximate value of root 2. Start the iteration from x0=1, and obtain two iterations.
discuss the technique for implementing high performance computing
I want to make my career in networking so how to going there? right now i have done a+ n+ ccna course from cms com institute but i m not certified with globle certification os what is my frist step ?, my finincial prob also with me plz sorry isubmit it
How would Nvidia increase the core clock speed anymore?
What is STP
hey frnds..i have taken an emergency interview date of 21st july and my school is starting from 8th sept...i was continuously checking the date from 10 days but was not able to get a normal date...so can i get a rejection on this, that i have taken an emergency date.??????
The Barnes Foundation in Philadelphia has one of the most extra-ordinary and idiosyncratic collections in French impressionist art. Dr. Barnes who put together this collection has insisted that the paintings be hung in a particular manner specified by him at a museum designed by the French architect Paul Philippe Cret who also designed the Rodin Museum. The museum has, say, seven galleries – Eugene Boudin, Cassatt, Boudin, Forain, Gonzales, Manet and Monet. Visitors reach the main Eugene Boudin by an elevator, and they can enter and leave the exhibition only through Eugene Boudin gallery. Once inside, visitors are free to move as they choose. The following list includes all of the doorways that connect the seven galleries: There is a doorway between Eugene Boudin and Cassatt, a doorway between Eugene Boudinand Boudin, and a doorway between Eugene Boudin and Gonzales galleries. There is a doorway between Cassatt and Boudin galleries. There is a doorway between Gonzales and Forain and a doorway between Gonzales and Manet galleries. There is a doorway between Manet and Monet galleries. Which of the following rooms CANNOT be the third gallery that any visitor enters ?
give me some knowledge about automation on which asked on interview
what is disadvantages of waterfall model ?? industry used which model ??