Advertisement
Anik_Akash

at coder B

May 17th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main()
  5. {
  6.     char str[105];
  7.     int k, ln, i;
  8.     int unused __attribute__((unused));
  9.     unused = scanf("%d",&k);
  10.     unused = scanf("%s", str);
  11.     ln = strlen(str);
  12.     char n[k];
  13.     if(ln <=k){
  14.         printf("%s\n", str);
  15.     }
  16.     else{
  17.         for(i=0; i<k; i++){
  18.        n[i]=str[i];
  19.         }
  20.         printf("%s...\n", n);
  21.     }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement