Friday, December 13, 2019

Write a source code for C++ and Java program to Enter "Hello, My first program " and print ?



Source code for C++ program to display "Hello, My first program".

#include <iostream.h>
#include <conio.h>
void main ()
{
clrscr();
char a;
cout<<" Enter Hello, My first program ";
cin>>a;
getch();
}




Source code for Java program to display "Hello, My first program". 


import java.util.Scanner();
Class firstpgm 
{
public static void main (Strings [] args )
{
char a;
Scanner sc=new Scanner(System.in);
System.out.println("Enter Hello, My first program");
a=sc.next();
System.out.println(a);
}
}



No comments:

Post a Comment