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

What is pre-emptive data structure and explain it with example?

3724


What is the equivalent code of the following statement in WHILE LOOP format?

1302


Explain the difference between ++u and u++?

1132


What is the difference between call by value and call by reference in c?

1159


How can I recover the file name given an open stream?

1007


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

1250


What are the types of variables in c?

1018


What are the types of data files?

1199


How can you call a function, given its name as a string?

1155


Write a program of advanced Fibonacci series.

1146


What is actual argument?

1060


Can we access the array using a pointer in c language?

1047


How do you determine a file’s attributes?

1078


Why we use void main in c?

1161


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

16006