Write a C++ program to calculate the square of mid digit of a 3 digit number. (Without loop) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write a C++ program to calculate the square of mid digit of a 3 digit number. (Without loop)

plz help me guys...m not getting answer of this question...

3rd Jan 2018, 6:05 AM
Lord Of Victory...
Lord Of Victory... - avatar
4 Answers
+ 2
int n,s; cin>>n; if(n>100&&n<1000){ s=(n%100)/10; cout<<s*s;} else cout<<n*n;
3rd Jan 2018, 3:50 PM
Gudla Swathi
Gudla Swathi - avatar
+ 2
if n is not a three digit number
3rd Jan 2018, 3:54 PM
Gudla Swathi
Gudla Swathi - avatar
+ 1
can u explain me how to execute this
3rd Jan 2018, 8:16 AM
Lord Of Victory...
Lord Of Victory... - avatar
0
Write a c++ program which requests the user to enter a number.The number and the squares of the number are then printed on the same line.
10th May 2021, 3:37 PM
Snigdha Mohanty
Snigdha Mohanty - avatar