+ 5

C program Challenge! Square of Digits.

Write a C program to do the following: It ask user to enter a numeric value. Then your program should square the each digit and concatenate it and stores into another variable. Then it prints the result variable. Eg: input : 123 output : 149 input : 1529 output: 125481 Conditions: Use only stdio.h and conio.h Use only primitive integer data type. use least number of variable. _________________________________________ Hope you understand the challenge. Happy Coding.

29th Dec 2017, 4:07 PM
Saurabh Verma
Saurabh Verma - avatar
11 Respostas
+ 3
https://code.sololearn.com/c4IalkP9ZRf2/?ref=app Only 14 line code and work same!😊
10th Jan 2018, 4:13 AM
Saurabh Verma
Saurabh Verma - avatar
29th Dec 2017, 10:38 PM
Med Arezki
Med Arezki - avatar
+ 3
https://code.sololearn.com/cU5WAxUpqf8s/?ref=app
29th Dec 2017, 7:18 PM
Harjeet Singh
Harjeet Singh - avatar
30th Dec 2017, 6:11 PM
Ahmed Saleh Alsayadi
Ahmed Saleh Alsayadi - avatar
+ 2
https://code.sololearn.com/cP0azBqVf13G/?ref=app Here is mine code.😊
30th Dec 2017, 1:40 AM
Saurabh Verma
Saurabh Verma - avatar
31st Dec 2017, 2:39 PM
Diego
Diego - avatar
+ 1
@HaRjit SiNgh, Cool code. You used too much variables, but you can reduce the variable declaration also. works like charm.
30th Dec 2017, 1:10 AM
Saurabh Verma
Saurabh Verma - avatar
+ 1
@Med Arezki Jr. Nice try, but your code is valid for 3 digits only. Make some changes to work perfectly. Happy coding
30th Dec 2017, 1:13 AM
Saurabh Verma
Saurabh Verma - avatar
30th Dec 2017, 4:17 PM
Saurabh Verma
Saurabh Verma - avatar
0
your output comes in reverse plz beg me .. https://code.sololearn.com/ci5YBkJBBmtT/?ref=app
29th Dec 2017, 5:24 PM
Yesh Jadav
Yesh Jadav - avatar
0
@Yesh Jadav, you are printing each squared digits one by one, but challenge is to store all squared digit into one single variable and then finally print that variable value. Make some changes. btw, nice effort
30th Dec 2017, 1:08 AM
Saurabh Verma
Saurabh Verma - avatar