import java.util.Scanner;
class Swastik{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter number");
int num = sc.nextInt();
for(int i=1;i<=num;i++)
{
for(int j=1;j<=num;j++)
{
if((j==1 && i<=num/2) || (j==num/2) || (i==num/2)||(i==1 && j>=num/2) || ((i==num/2 || j==num) && i>num/2) || (i==num && j<=num/2))
{
System.out.print("*");
}
else
System.out.print("...
Matrix multiplication
import java.util.Scanner;
class MatrixMul{
public static void main(String args[])
{
int a[][]= new int[3][3];
int b[][]= new int[3][3];
int c[][]=new int[3][3];
int i,j,k;
Scanner sc = new Scanner(System.in);
System.out.println("enter Element 9 of 1st String");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
a[i][j]=sc.nextInt();
}
}
System.out.println("enter Element 9 of 2nd String");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
b[i][j]=sc.nextInt();
}
}
System.out.println("Matrix...
Arrange String character wise
import java.util.Scanner;
class StringCharSort{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter a String:");
String str = sc.nextLine();
char ch[] = str.toCharArray();
for(int i=0;ich.length;i++) {="" for(int j=1;jch.length;j++)
{
if(ch[j-1]>ch[j])
{
char temp = ch[j-1];
ch[j-1]=ch[j];
ch[j]=temp;
}
}
}
for(char c :ch)
...
How to check given String is palindrom or not in java
String is palindrom or not
import java.util.Scanner;
class StringPalindrom{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter a line");
String str = sc.nextLine();
String str1="";
char ch[] = str.toCharArray();
for(int i=ch.length-1;i>=0;i--)
{
str1+=ch[i];
}
if(str.equals(str1))
System.out.println("Palindrom");
else
System.out.println("Not palindrom");
}
}
...
Differences Between C , C++, and Java
Differences Between C , C++, and Java
Table Comparing C, C++ and Java:
This table is a summary of the differences found in the article.
Feature
C
C++
Java
Programming Approach
Procedural Programming Language
Procedural, OOP, Generic Programming languages
OOP, Generic Programming languages.
Compiled Source Code
Executable in Native Code
Executable in Native Code
Compiled into Java byte code
Memory management
Manual Done,
Manual Done,
Managed,...