a)Write a program that prompts the user to enter an 8-character password, then p
ID: 3542917 • Letter: A
Question
a)Write a program that prompts the user to enter an 8-character password, then prints the characters back to the screen along with their corresponding ASCII values.b) Modify the program. determine if the password entered matches the characters a)Write a program that prompts the user to enter an 8-character password, then prints the characters back to the screen along with their corresponding ASCII values.
b) Modify the program. determine if the password entered matches the characters b) Modify the program. determine if the password entered matches the characters
Explanation / Answer
// PROGRAM A is:
#include<stdio.h>
#include<string.h>
int main()
{
int i=0;
char password[8];
printf("Enter password :");
scanf("%s",password);
for(i=0; i<strlen(password); i++)
{
printf(" %c corresponding ASCII value is %d ",password[i],password[i]);
}
return 0;
}
// PROGRAM B to see password matches to APSC1413 or NOT.
#include<stdio.h>
#include<string.h>
int main()
{
int i=0;
char password[8];
printf("Enter password :");
scanf("%s",password);
if(strcmp(password,"APSC1413")==0)
printf(" Your password is Valid.");
else
printf(" Your password is not Valid.");
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.