In: Computer Science
Define a char variable.
Read a char value from the keyboard into the variable.
Print the variables value.
IN C:
CODE:
#include<stdio.h>
int main()
{
char a;scanf("%c",&a);
printf("variable is: %c", a);
return 0;
}
OUTPUT:
IN C++:
CODE:
#include<iostream>
using namespace std;
int main()
{
char a;cin>>a;
cout<<"variable is: "<<a;
return 0;
}
OUTPUT:
IN PYTHON:
IN JAVA:
CODE:
import java.util.*;
class A
{
public static void main(String args[])
{
Scanner sc = new
Scanner(System.in);
char a = sc.next().charAt(0);
System.out.println("Variable is: "
+ a);
}
}
OUTPUT: