string input in c

Solutions on MaxInterview for string input in c by the best coders in the world

showing results for - "string input in c"
Eleonora
24 May 2016
1#include<stdio.h>
2#include<conio.h>
3void main(){
4chat sam[10];
5clrscr();
6printf("ENTER STRING NAME :");
7gets(s);
8printf("STRING :%s",s);
9getch();
10}
Anael
12 Nov 2017
1#include <stdio.h>
2#include <string.h>
3#include <math.h>
4#include <stdlib.h>
5
6int main() 
7{
8
9    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
10    char ch;
11    char s[100];
12    char p [100];
13    scanf("%c", &ch);
14    scanf("%s", s);
15    scanf("\n");
16    scanf("%[^\n]%*c", p);
17    
18    printf("%c \n", ch);
19    printf("%s \n", s);
20    printf("%s", p);
21    return 0;
22}
23
Alessandra
11 Jun 2017
1#include <stdio.h>
2
3int main () {
4   char str1[90], str2[90];
5
6   printf("Enter name: \n");
7   scanf("%s", &str1);
8
9   printf("Enter your website name: \n");
10   scanf("%s", &str2);
Paula
25 Jun 2019
1#include <stdio.h>
2
3int main () {
4   char str1[90], str2[90];
5
6   printf("Enter name: \n");
7   scanf("%s", str1);
8
9   printf("Enter your website name: \n");
10   scanf("%s", str2);
11
12   printf("Entered Name: %s\n", str1);
13   printf("Entered Website:%s\n", str2);
14   
15   return(0);
16}