Help With C Programming Output | Troubleshooting Solutions

  • Thread starter Thread starter chemic_23
  • Start date Start date
  • Tags Tags
    C code Code
Click For Summary
SUMMARY

This discussion focuses on troubleshooting output issues in C programming, specifically regarding how to display detailed solutions rather than just final answers. The user is advised to enter numbers as integers and validate their range. Key steps include checking if a number is two or three digits and breaking down a two-digit number into its individual digits for further processing. The conversation emphasizes the importance of methodical number handling in C programming.

PREREQUISITES
  • Basic understanding of C programming syntax and structure
  • Knowledge of integer data types in C
  • Familiarity with conditional statements for input validation
  • Experience with number manipulation techniques in programming
NEXT STEPS
  • Learn about input validation techniques in C programming
  • Explore functions for digit extraction from integers in C
  • Study the use of conditional statements for range checking
  • Investigate debugging methods for C programming output issues
USEFUL FOR

C programmers, students learning C, and anyone troubleshooting output formatting and number handling in their code.

chemic_23
Messages
44
Reaction score
0
apn.png



my attempt is

sol.png


(this is c programming)

My output is really different. It gives the answer but not a detailed solution as the output above.

Pls help me I really don't know how to show the long method :frown:
 
Technology news on Phys.org
chemic_23 said:
apn.png



my attempt is

sol.png


(this is c programming)

My output is really different. It gives the answer but not a detailed solution as the output above.

Pls help me I really don't know how to show the long method :frown:

There are quite a number of ways to proceed. It is probably easiest to enter numbers as integers, as you are doing. To be really safe, you can also check that each number is in the correct range of values before proceeding.

Step 1. How could you check that a number is a 2 digit or a 3 digit number?

In order to do the steps described, you need to break the second number into digits.

Step 2. If you know you have a two digit number in "y", can you figure out how to get the two digits?

That will do for a start...

Cheers -- sylas
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
5
Views
2K
Replies
13
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
6K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K