Write a C program to get a character from the user using getchar() and print it using printf().

0 votes
asked Feb 13, 2018 by anonymous
the complete program for this question

4 Answers

0 votes
answered Feb 13, 2018 by anonymous
the sample input is *

the sample output is *
–1 vote
answered Feb 13, 2018 by anonymous
#include<stdio.h>

int main()

{

char *;

*=getchar();

printf("getchar()"');

return0;

}
commented Feb 14, 2018 by Sushmeetha Reddy (100 points)
here,*is not a variable right.how does it stores?
+1 vote
answered Feb 13, 2018 by MSW IT (160 points)
#include<stdio.h>
void main()
{
              char c;
              c=getchar();
              //to print the same character using printf...
              printf("%c",c);
}
0 votes
answered Feb 14, 2018 by niraj singh (140 points)
int main()

{

char var;

var=getchar();

printf("getchar() = %c",var);

return 0;

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...