namereq

1文字目から n 文字目までを出力

Jun 23rd, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.24 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(void){
  3.     int n;/*表示文字数*/
  4.     int i;/* ループ変数 */
  5.     char s[100],*p;/*入力する文字と表示させる文字*/
  6.     p=s;
  7.     scanf("%s",s);
  8.     scanf("%d",&n);
  9.     for(i=0;i<n;i++,p++){
  10.         putchar(*p);
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment