/* java program to find square root of a Number */
class MathDemo{ public static void main(String args[]){ // values for square root double a = 144; double b = 9; //result of square root System.out.println("\nSquare root of 144 is : "+Math.sqrt(a)); System.out.println("\n Squre root of 9 is : "+Math.sqrt(b)); }
}
o/p
Square root of 144 is :12
Square root of 9 is : 3
/* write a C program to check Enter character is Alphanumeric or Not */ #include<stdio.h> #include<conio.h> #include<ctype.h> // library for islower function must require it void main() { char c; printf("Enter character : "); scanf("%c",&c); if(isalnum(c)==0) printf("Enter character is Not alphanumeric character"); else printf("Enter character is alphanumeric character"); getch();
#include<stdio.h> #include<conio.h> #include<ctype.h> // library for islower function must require it void main() { char c; printf("Enter character : "); scanf("%c",&c); if(isupper(c)==0) printf("Enter character is Not a upper case character"); else printf("Enter character is upper case character"); getch();
#include<stdio.h>
#include<conio.h>
#include<ctype.h> // library for islower function must require it
void main()
{
char c;
printf("Enter character : ");
scanf("%c",&c);
if(islower(c)==0)
printf("Enter character is Not a lower case");
else
printf("Enter character is Lower case");
getch();
class MyThread extends Thread{ public void run(){ // print child thread 5 times here for(int i =0 ; i<=5 ; i++){ System.out.println("child Thread...."); } }
}
//main method class which is main thread here
class JoinDemo{ public static void main(String args[]){ // this is main thread // print main thread here // create thread MyThread t = new MyThread(); t.start(); // start child thread here try{ t.join();// pause main thread here and after complete t resume current thread }catch(Exception e){ System.out.println("Exception caught "+e); } for(int i =0 ; i<=5 ; i++){ System.out.println(" Main Thread...."); } }
}