Sunday, February 16, 2020

how to Program for reading integers, characters and strings from the keyboard and displaying them in C language

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

void main()
{int i;
char c , a[20];
printf("\n enter a character");
scanf("%c",&c);
printf("\n enter an integer");
scanf("%d",&i);
printf("\n enter a string");
scanf("%s",a);
printf("\n given character = %c",c);
printf("\n given integer = %d",i);
printf("\n given string = %s",a);
getch();
}

output:
 enter a charactera

 enter an integer123

 enter a stringanildurgam

 given character = a
 given integer = 123
 given string = anildurgam

No comments:

Post a Comment

python class topic video