Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

WAP in Java to print the format A B A B C D E D E

1985


how will u test the idoc

1913


what is domain functional level in windows server 2003?

2097


who is your role modal give in few sentances

2115


how will u recieve idoc

1952


write a c++ program to interchange two-integer number without using the third variable. use concept of constructor overloading.

2218


please send me latest Aptitude Test paper

2110


If any kind of accident happen without any information to any one .what kind of action we have to take

1794


How will I MOve Comp-1 variable into next variable without using Move statement?

1995


Differentiate y = sinx + cosx + tanx

992


what is far pointer?

1849


what do you mean by a p-code?

1986


Is printf(?%d?,p); valid?

1991


what is polymorphism.

1813


What is Symbian.?

1930