Answers for "how to get a string input in c"

2

input output string in c

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main() 
{

    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    char ch;
    char s[100];
    char p [100];
    scanf("%c", &ch);
    scanf("%s", s);
    scanf("\n");
    scanf("%[^\n]%*c", p);
    
    printf("%c \n", ch);
    printf("%s \n", s);
    printf("%s", p);
    return 0;
}
Posted by: Guest on April-25-2021
0

string input in c

#include <stdio.h>

int main () {
   char str1[90], str2[90];

   printf("Enter name: \n");
   scanf("%s", &str1);

   printf("Enter your website name: \n");
   scanf("%s", &str2);
Posted by: Guest on September-13-2021
1

getting string input in c

#include<stdio.h>
#include<conio.h>
void main(){
chat sam[10];
clrscr();
printf("ENTER STRING NAME :");
gets(s);
printf("STRING :%s",s);
getch();
}
Posted by: Guest on March-16-2021
5

Syntax To Take Input In C

Integer: Input: scanf("%d", &intVariable); Output: printf("%d", intVariable);
Float: Input: scanf("%f", &floatVariable); Output: printf("%f", floatVariable);
Character: Input: scanf("%c", &charVariable); Output: printf("%c", charVariable);
Posted by: Guest on August-12-2020
-1

how to get string input in c

#include <stdio.h>

int main () {
   char str1[90], str2[90];

   printf("Enter name: \n");
   scanf("%s", str1);

   printf("Enter your website name: \n");
   scanf("%s", str2);

   printf("Entered Name: %s\n", str1);
   printf("Entered Website:%s\n", str2);
   
   return(0);
}
Posted by: Guest on July-07-2021
0

how to get a string input in c

char s[10];
scanf ("%s",s);
printf(s);
Posted by: Guest on June-25-2021

Code answers related to "how to get a string input in c"

Browse Popular Code Answers by Language