Please help me, I am really having a hard time to program these:
1. Write a program that input integer and displays the digits diagonally.
Ex. Entered number: 3562
output: 3
5
6
2
2. Write a program that read in a number n and then outputs the sum of the aquares of the number n and then outputs the sum of the squares of the numbers from 1 to n. if the input is 3, for example, the output should be 14. The program should allow the user to repeat this calculation as often as desired.
--------------------------------------------------------------------
I tried solving it but there are always errors. I think looping is needed to solve that. And how to display the output diagonally?
pls help.
Here's what ive tried for number 1:
I know that it is not right but that is the only idea i have.Code:#include<stdio.h> #include<conio.h> void main () { char string[256]: printf("input nuber: \n"); scanf("%s", &number); printf("%s", string); getch(); }
PLEAS HELP.
This kind of question is included in our exam.