int main() {
unsigned int a; // Change 'int' to 'unsigned int' printf("Enter your number: "); scanf("%x", &a); // Now 'a' matches '%x' expected type printf("a = %u\n", a); // Use '%u' to correctly print an unsigned int return 0; }
This commit is contained in:
parent
523764a45c
commit
79f83aa190
1 changed files with 6 additions and 7 deletions
|
@ -1,12 +1,11 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int a, b;
|
||||
int main() {
|
||||
unsigned int a; // Change 'int' to 'unsigned int'
|
||||
|
||||
printf("Enter your number : ");
|
||||
scanf("%x", &a);
|
||||
printf("a = %d\n", a);
|
||||
printf("Enter your number: ");
|
||||
scanf("%x", &a); // Now 'a' matches '%x' expected type
|
||||
printf("a = %u\n", a); // Use '%u' to correctly print an unsigned int
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue