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...

write a c program to find the square of a 5 digit number
and print the result.

Answer Posted / paras

#include<stdio.h>
#include<conio.h>
void main(){
clrscr();
long a=0,b=0;
long num;
printf("Enter a 5 digit number: ");
scanf("%ld",&num);
a=num/100;
b=num%100;
printf("Square of this number is: ");
long c=2*a*b;
a=a*a;
b=b*b;
long t=c%100;
t*=100;
t+=b;
long w=c/100;
w+=a;
if(t/10000 <= 0)
printf("%ld",w);
else
{
w=w+t/10000;
t=t%10000;
printf("%ld",w);

}
if(t/10==0)
printf("000%ld",t);
else if(t/100==0)
printf("00%ld",t);
else if(t/10==0)
printf("0%ld",t);
else
printf("%ld",t);
getch();
}

Is This Answer Correct ?    7 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where are some collections of useful code fragments and examples?

1164


What are the types of data files?

1206


What is hashing in c?

1165


Is main an identifier in c?

1145


What is the behavioral difference when include header file in double quotes (“”) and angular braces (<>)?

1347


What is dynamic variable in c?

1034


What is the right type to use for boolean values in c? Is there a standard type?

1018


Find MAXIMUM of three distinct integers using a single C statement

1071


When I set a float variable to, say, 3.1, why is printf printing it as 3.0999999?

1071


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

2185


I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

2237


What do you mean by recursion in c?

1114


What are the Advantages of using macro

1177


What is c++ used for today?

1110


difference between native and cross compilers

2131