Implementation Of Checksum C Program

Algorithm Steps:
Step 1: Include the header file.
Step 2: Get two hexadecimal value from user in one and two.
Step 3: Add one and two and share the result in check.
Step 4: Find complement of the check and display its value.
Step 5: Find the complement of check result and display it.
Step 6: If the check of check result is 0 then print the checksum of code generated is correct.
Step 7: Else print the checksum of code generate is not correct.
Step 8: stop the program.
int main()
unsigned int one;
unsigned int two;
unsigned int check;
unsigned int checkresult;

printf("\nEnter the first hex value:");

printf("\nEnter the second hex value:");


printf("\nThe value of check is:%x",check);

printf("\The value of checkresult:%x",checkresult);
printf("\n The value of answer is :%x",check result);
printf("\n The check sum of the code generated is not correct");
[cseb56@localhost cseb56]$ cc che10.c
[cseb56@localhost cseb56]$./a.out
Enter the first hex value : 12345678
Enter the second hex value : 87654321
The value of check is : 66666666
The value of checkresult is : ffffffff
The value of answer is : 0
the check sum of the code generated is correct

Post a Comment