Posts

Showing posts from April, 2012

To find the given number is armstrong or not

/* To find the given number is armstrong or not */ # include <stdio.h> # include <conio.h> void main() { int n, r, s = 0, t ; clrscr() ; printf("Enter a number : ") ; scanf("%d", &n) ; t = n ; while(n > 0) { r = n % 10 ; s = s + (r * r * r) ; n = n / 10 ; } if(s == t) printf("\n%d is an armstrong number", t) ; else printf("\n%d is not an armstrong number", t) ; getch() ; } RUN 1 : ~~~~~~~ Enter a number : 153 153 is an armstrong number RUN 2 : ~~~~~~~ Enter a number : 123 123 is not an armstrong number

Program to check whether Prime or Not

/* To check whether the given no. is prime or not - CHKPRIME.C */ # include <stdio.h> # include <conio.h> void main() { int i, n, flag = 0 ; clrscr() ; printf("Enter the Number : ") ; scanf("%d", &n) ; if(n <= 3) flag = 0 ; else { for(i = 2 ; i <= n / 2 ; i++) if(n % i == 0) { flag = 1 ; break ; } } if(flag == 1) printf("\nThe number is not prime") ; else printf("\nThe number is prime") ; getch() ; } RUN 1 : ~~~~~~~ Enter the Number : 6 The number is not prime RUN 2 : ~~~~~~~ Enter the Number : 11 The number is prime

JAVA STRUCTURE AND JAVA PLATFORM

Image
 JAVA Platform Simple JAVA Structure

Important point of JAVA

1) overriden method doesn't throws IOException 2)If all variables =null , then its shows runtimeexception (NULLPOINTEREXCEPTION) 3) If catch(Exception e) {} catch(ArithmeticException e) {}  -> shows error bcos ArithmeticException that subclass of excetion. 4) catch(ArithmeticException e) {} catch(Exception e) {}   -> it allows 5)  ENUM related : Correct lines class enum2 {  public enum Direction {NORTH,WEST,EAST} public class aa() { //enum2.Direction d=enum2 Dirction.NORTH;    Direction d = Direction.NORTH;  It allows } } 6) Direction {NORTH,WEST,EAST}    the expression (NORTH==NORTH) and NORTH.equals(NORTH) both are true 7)It is possible for more than two threads to deadlock at once. If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield(). 9890040911 shridhar jahagirdar 8) sum ref. variables on stack and sum on heap. 9)  Treeset : provide array m

Command Prompt Coommands

Arp The arp command is used to display or change entries in the ARP cache. Assoc The assoc command is used to display or change the file type associated with a particular file extension. At The at command is used to schedule commands and other programs to run at a specific date and time. Attrib The attrib command is used to change the attributes of a single file or a directory. Auditpol The auditpol command is used to display or change audit policies. Bcdedit The bcdedit command is used to view or make changes to Boot Configuration Data. Bitsadmin The bitsadmin command is used to create, manage, and monitor download and upload jobs. Bootcfg The bootcfg command is used to build, modify, or view the contents of the boot.ini file, a hidden file that is used to identify in what folder, on which partition, and on which hard drive Windows is located. Break The break command sets or clears extended CTRL+C checking on DOS systems Cacls The cacls command is used to display or change access con