write a c program to Create a mail account by taking the
username, password, confirm password, secret_question,
secret_answer and phone number. Allow users to register,
login and reset password(based on secret question). Display
the user accounts and their details .

Answers were Sorted based on User's Feedback



write a c program to Create a mail account by taking the username, password, confirm password, secr..

Answer / puneet mittal

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char username[20][20],username1[20][20],answer[20][20];
int password[5],password1[5],password2[5],phno[5],n,i;
int confirmpassword[5],ans;
char qst[20][20];
char secretanswer[20][20];
printf("Number of user to create a mail account :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nusername :");
scanf("%s",username[i]);
pass:
printf("\npassword :");
scanf("%d",&password[i]);
printf("\nconfirm password:");
scanf("%d",&confirmpassword[i]);
if(password[i]==confirmpassword[i])
{
printf("Enter secret Question :");
scanf("%s",&qst[i]);
printf("Enter secret Answer:");
scanf("%s",&secretanswer[i]);
printf("Phone number :");
scanf("%d",&phno[i]);
}
else
{
printf("\n Repassword doesn't
match.Retype your password and confirm it again.");
goto pass;
}
printf("\n\nRegistration Succesful");
}
for(i=0;i<n;i++)
{
printf("\nLog in Account : \n");
pass1 :
printf("\nusername : \t");
scanf("%s",username1[i]);
printf("password :\t");
scanf("%d",&password1[i]);

if((password1[i]==password[i])&&((strcmp(username1[i],username[i])==0)))
{
printf("you want to reset your
password say 1/0 :");
scanf("%d",&ans);
if(ans==1)
{
pass2:
printf("answer the following : ");
printf("%s:",qst[i]);
scanf("%s",answer[i]);

if((strcmp(secretanswer[i],answer[i])==0))
{
printf("Enter new password :");
scanf("%d",&password2[i]);
}
else
{
printf("sereat answer is wrong ,
TRY AGAIN .");
goto pass2;
}
password[i]=password2[i];
printf("account detail :");
printf("username :%s",username[i] );
printf("\nPassword
:%d",password[i] );
printf("Phone number : %d
",phno[i]);
}
else
if(ans==0)
{
printf("account detail :\n\n");
printf("\n username
:%s\n",username[i] );
printf("\n Password
:%d\n",password[i] );
printf("\n Phone number : %d\n
",phno[i]);
}
}
else
{
printf("\nUsername or password
is wrong, TRy AGAIN. ");
goto pass1;
}
}
getch();
}

Is This Answer Correct ?    11 Yes 5 No

write a c program to Create a mail account by taking the username, password, confirm password, secr..

Answer / sandhiya.m

#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char username[20][20],username1[20][20],answer[20][20];
int password[5],password1[5],password2[5],phno[5],n,i;
int confirmpassword[5],ans;
char qst[20][20];
char secretanswer[20][20];
printf("Number of user to create a mail account :");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\nusername :");
scanf("%s",username[i]);
pass:
printf("\npassword :");
scanf("%d",&password[i]);
printf("\nconfirm password:");
scanf("%d",&confirmpassword[i]);
if(password[i]==confirmpassword[i])
{
printf("Enter secret Question :");
scanf("%s",&qst[i]);
printf("Enter secret Answer:");
scanf("%s",&secretanswer[i]);
printf("Phone number :");
scanf("%d",&phno[i]);
printf("\n\n registration successfull");
}
else
{
printf("\n acount created not successful");
}
}
getch();
}

Is This Answer Correct ?    4 Yes 9 No

Post New Answer

More C Code Interview Questions

what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,






Give a one-line C expression to test whether a number is a power of 2.

10 Answers   Microsoft,


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }

2 Answers   Persistent,


#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }

0 Answers   Student,


Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector

2 Answers  


1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?

2 Answers  


main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }

1 Answers  


Categories