Search

Getchar() function in C || C Programs

Code -

#include <stdio.h> 
#include <conio.h>     
void main()  
{  
 char c;   
    printf ("\n Enter a character \n");  
    c = getchar(); // get a single character 
    printf(" You have passed ");  
    putchar(c); // print a single character using putchar 
 
    getch();  
}  

Output -

Enter a character
A
 You have passed A
2 views0 comments

Related Posts

See All

Program of Random Number in C || C Programs

Code - #include <stdio.h> #include <conio.h> #include <stdlib.h> void main() { // use rand() function to generate the number printf (" The random number is: %d", rand()); pri

GCD of two numbers in C || C Programs

Code - #include <stdio.h> #include <conio.h> int main() { // declare the variables int n1, n2, i, GCD_Num; printf ( " Enter any two numbers: \n "); scanf ( "%d %d", &n1, &n2);

  • 1024px-Telegram_logo.svg
  • download
  • YouTube