Originally Posted by
Noor
I am meant to encrypt a 4-digit combination the last and first digits should be swapped and 9 should be subtracted from the second and third digit. I don't know if this is right though could someone please guide me
Code:
#include <stdio.h>
int main(void)
{
int digit1,digit2,digit3,digit4;
printf("Enter an encrypted 4-digit combination:");
scanf("%d%d%d%d \n",&digit1,&digit2,&digit3,&digit4);
digit1=(digit4);
digit2=(9-digit2);
digit3=(9-digit3);
digit4=(digit1);
printf("The real combination is:");
printf("%d%d%d%d",&digit1,&digit2,&digit3,&digit4);
return 0;
}
You should start a new forum topic each time you have a new question.
It's good to see that you have code this time
Code:
scanf("%d %d %d %d",&digit1,&digit2,&digit3,&digit4);
Might be a good start