Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char age[3];
- char name[30];
- char id[20];
- printf("Enter your name: ");
- scanf("%[^\n]%*c", name);
- printf("Enter your student ID: ");
- scanf("%[^\n]%*c", id);
- printf("Enter your age: ");
- scanf("%s",age);
- char f6name[100];
- strncpy(f6name, name, 6);
- f6name[6] = '\0';
- char f2id[100];
- strncpy(f2id, id, 2);
- f2id[2] = '\0';
- printf("\nYour password is: %s%s%s\n", f6name, age, f2id);
- int len = 8 + strlen(age);
- printf("The password has %d charecters",len);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement