File tree Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 7474// }
7575// 👉👉 🔹🔹 question 4️⃣ take a string input from the user using %c
7676
77-
7877#include <stdio.h>
7978int main (){
80- char str [ 120 ];
81- char ch ;
82- int i = 0 ;
83- while (ch != '\n' )
84- {
85- scanf ("%c" , & ch );
86- str [i ] = ch ;
87- i ++ ;
88- }
89- str [i ] = '\0' ;
90- puts (str );
91-
79+ char srt [ 15 ];
80+ char ch ;
81+ int i = 0 ;
82+ while (ch != '\n' )
83+ {
84+ scanf ("%c" , & ch );
85+ srt [i ] = ch ;
86+ i ++ ;
87+ }
88+ srt [i ] = '\0' ;
89+ puts (srt );
90+
9291 return 0 ;
9392}
9493
94+ // #include <stdio.h>
95+ // int main(){
96+ // char str[120];
97+ // char ch;
98+ // int i = 0;
99+ // while (ch != '\n')
100+ // {
101+ // scanf("%c" , &ch);
102+ // str[i] = ch;
103+ // i++;
104+ // }
105+ // str[i] = '\0';
106+ // puts(str);
107+
108+ // return 0;
109+ // }
110+
95111// #include <stdio.h>
96112// int main(){
97113 // return 0;
You can’t perform that action at this time.
0 commit comments