package javaapplication3;
|
Wednesday, January 9, 2013
Problem 92
Tuesday, January 8, 2013
Sieve of Eratosthenes - primes
|
Friday, November 16, 2012
Sunday, October 21, 2012
leap year
/**
* A program to tell whether an year is leap year or not.
* @author Umang Bhatt
*/
public class LeapYearTester
{
public static boolean isLeapYear(int year)
{
boolean isLeapYear ;
if (year % 4 == 0)
{
if (year % 100 == 0)
{
if (year % 400 == 0)
{
isLeapYear = true;
}
else
{
isLeapYear = false;
}
}
else
{
isLeapYear = true;
}
}
else
{
isLeapYear = false;
}
return isLeapYear;
}
public static void main(String args[])
{
System.out.println(isLeapYear(2003));
}
}
Labels:
flow chart,
flowchart,
java,
leap year,
umang bhatt
Thursday, September 6, 2012
clear screen in java
Clearing the screen with Java in platform independent way (on both Windows and Linux platform).
Here are the videos that show how to clear the console:
Part 1
Part 2
You can download JANSI from http://jansi.fusesource.org/
You can refer to the API docs from http://jansi.fusesource.org/documentation/api/index.html
Here are the videos that show how to clear the console:
Part 1
Part 2
You can download JANSI from http://jansi.fusesource.org/
You can refer to the API docs from http://jansi.fusesource.org/documentation/api/index.html
Monday, September 3, 2012
one program many ways
Program to check whether a number is positive, negative or is zero:
(I did this while one of the teaching sessions in a few minutes to encourage student for coming out with new solutions )many programs same thing:
1:
2:
1:
#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a==0)
{
printf(" %d number is 0",a);
}
else
{
if(a>0)
{
printf(" %d number is possitive",a);
}
else
{
printf("%d number is nagitive",a);
}
}
return 0;
}
2:
#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a>0)
{
printf(" %d number is possitive",a);
}
else if(a<0)
{
printf("%d number is nagitive",a);
}
else if(a==0)
{
printf(" %d number is 0",a);
}
return 0;
}
3:#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a>0)
{
printf(" %d number is possitive",a);
}
else if(a<0)
{
printf("%d number is nagitive",a);
}
else
{
printf(" %d number is 0",a);
}
return 0;
}
4:#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a>0 || a<0 )
{
if(a>0)
{
printf(" %d number is possitive",a);
}
else if(a<0)
{
printf("%d number is nagitive",a);
}
}
else
{
printf(" %d number is 0",a);
}
return 0;
}
5:#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a>0 | a<0 )
{
if(a>0)
{
printf(" %d number is possitive",a);
}
else if(a<0)
{
printf("%d number is nagitive",a);
}
}
else
{
printf(" %d number is 0",a);
}
return 0;
}
6:#include<stdio.h>
int main()
{
int a,b;
printf("enter the number");
scanf("%d",&a);
if(a!=0)
{
if(a>0)
{
printf(" %d number is possitive",a);
}
else
{
printf("%d number is nagitive",a);
}
}
else
{
printf(" %d number is 0",a);
}
return 0;
}
Thursday, July 26, 2012
presentation on version control
dear readers
here is a link to one of my presentation that i gave at collage (actually its a recording of the presentation done at home, and is of not great quality)
here is a link to one of my presentation that i gave at collage (actually its a recording of the presentation done at home, and is of not great quality)
Subscribe to:
Posts (Atom)
