C Books Guide and List
C++ Books Guide and List
Best Java Books

3,749 questions

4,049 answers

114 comments

10,705 users

Write a C program to calculate the square of those numbers only whose least significant digit is 5

0 votes
2,917 views
asked Jan 6, 2014 by smith Geek (15,340 points)

1 Answer

0 votes

#include<stdio.h>

#include<conio.h>

void main()

{

int s,d;

clrscr();

printf(“Enter a number:”);

scanf(“%d”, &s);

d=s%10;

if(d= =5)

{

s=s/10;

printf(“\n square=%d%d”, s*s++, d*d);

}

Else

Printf(“\n Invalid number”);

}

Output:

Enter a number: 25

Square =625 

answered Jan 6, 2014 by rajesh Guru (39,140 points)
Why we have to divide s by 10

Related questions

0 votes
1 answer 62 views
62 views asked Jan 6, 2014 by sara Guru (24,570 points)
0 votes
1 answer 22 views
0 votes
1 answer 43 views
0 votes
1 answer 32 views
...