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 Posted / 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 |
Post New Answer View All Answers
Q1. A. Discuss the various types of variables. B. How to control the file? Q2. A. How the image application? B. Write short notes on trees structures work. Q3. A. How to load and unload child forms. B. When should we use recursive programming Q4. A. Write short notes on “The ole control’s shortcut menu” B. How to test the AX stat class Q5. A. How to use advanced data-bound controls. B. Write notes on manipulating the recordset object Q6. A. What is script control? B. How to down load image properties. C. What is meant by building a recordset.
i m a student of 4th year ,i m unable to get the embassy appointment dates , and it details.............please help any body.My id=john_searching143@yahoo.com
How to write a test case for an extra Commerce website can any one tell this with the help of a table
What is your Job Profile in IT feild.
I have completed my B.E with (CSE) computer science and engineering ,i had a total no of backlogs=20 ,is there any chances to get the visa PLEASE HELP ME NE1 : MY ID=john_searchig143@yahoo.com .
The old welding machine use electro- -magnetic winding to step up the current for welding rods,what is new principle inside the welding
how to connect oracle with java ? Give detail explanation.
Why the secondary ip address of interface is not advertising in IGP cloud?
i want to do oracle certification..could any one pleas tell me what is the level 1 certification exam in oracle? how do we get dumps?
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.??????
Define configuration and calibration and explain with an example
how to make resume and what should I include in it?
hi to all,i done ccna,now im looking job,but it is very diffcult to get job in networking field,.........i dnt know what im doing wrongly,kindly help me and give the proper way...i have so much of interest in this field only
Briefly describe an experience of yours that illustrates your ability to clearly articulate and explain technical issues in a nontechnical manner
What is the pressure in co2 cartridge in a DCP 5 kg extinguisher.