Advertisement
biswasrohit20

99

Apr 27th, 2021
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <string.h>
  4. int main()
  5. {
  6. char age[3];
  7. char name[30];
  8. char id[20];
  9. printf("Enter your name: ");
  10. scanf("%[^\n]%*c", name);
  11. printf("Enter your student ID: ");
  12. scanf("%[^\n]%*c", id);
  13. printf("Enter your age: ");
  14. scanf("%s",age);
  15. char f6name[100];
  16. strncpy(f6name, name, 6);
  17. f6name[6] = '\0';
  18. char f2id[100];
  19. strncpy(f2id, id, 2);
  20. f2id[2] = '\0';
  21. printf("\nYour password is: %s%s%s\n", f6name, age, f2id);
  22. int len = 8 + strlen(age);
  23. printf("The password has %d charecters",len);
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement