# Aatul Palandurkar

## Posts Tagged ‘AnCyber Pune’

### Java Program to find prime number upto N number

Posted on: March 13, 2016

Objectives :

• Write a Java program to find prime number upto N number
• Write a Java program to print prime number upto N number
• Write a Java program to find prime number upto N number using Command Line Arguments
• Write a Java Program to find prime number upto N number via Command Line Arguments
• Write a Java program to find prime number upto N number using Scanner class

Java Program / Code :

Method 1 : Java Program to find Prime Number upto N number using Scanner class

```
import java.util.Scanner;
{
public static void main(String[] args)
{
int n,p;
Scanner s=new Scanner(System.in);
System.out.println(“Enter number : ”);
n=s.nextInt();
for(int i=2;i<n;i++)
{
p=0;
for(int j=2;j<i;j++)
{
if(i%j==0)
p=1;
}
if(p==0){
System.out.println(i);
}
}
}
}
```

Method 2 : Java Program to find Prime Number upto N number using Scanner class and writing function to find prime number

Method isPrime() for checking if a number is prime or not

```public class PrimeNumber{
public boolean isPrime(int num) {
if ( num < 2 ){
return false;
}
for (int i = 2; i <= Math.sqrt(num); i++) {
if ( num % i == 0 ) {
return false;
}
}
return true;
}
}

// Mock Test Class to test above code
import java.util.Scanner;

public class Demo
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);

int num = scanner.nextInt();

if ( num < 2 ) {
System.out.println("\n There are no Prime Numbers available");
System.exit(0);
}
System.out.println("\n Prime Numbers from 1 to "+ num);

for (int i = 3; i <= num; i++) {
System.out.print(", " + i);
}
}
}
}
```

Method 3 : Java Program to find Prime Number upto N number using Command line input

```
{
public static void main(String[] args)
{
int n,p;
n=Integer.parseint(args[0]);
for(int i=2;i&lt;n;i++)
{
p=0;
for(int j=2;j&lt;i;j++)
{
if(i%j==0)
p=1;
}
if(p==0){
System.out.println(i);
}
}
}
}
```

Steps to run above program via command line :

2. Interpretation : C:\JavaPrograms>java PrimeNumber 20

Output :

2

3

5

7

11

13

17

19

### How should a trainer handle rude participants in a training workshop?

Posted on: September 4, 2015

Objectives:

• How should a trainer handle rude participants in a training workshop?
• Do’s and Don’ts for Trainer

The ability to handle rude participants is critical to success as a trainer as each trainer has at one or the other time encountered rude participants. The participants who continue talking, who work on their laptops while you are training, who continuously attend calls on their mobiles, who flat out say you are wrong or you have no clue what it is to be in their shoes, participants who recline on their chairs as if they are in a lounge, who ask irrelevant questions…. the list is endless.

So, what can you do to prevent rude participants from derailing or hijacking a training workshop?

1. Do some pre-work to ensure a great learning environment: Many things impact a participant even before they meet you: how was the training need communicated to them? Do they think they NEED training? etc. Many times these are out of our control but I like to request clients to copy me on emails they send to the participants.

2. Invest some time in the beginning of the session establishing your credibility and getting them to articulate why they should invest their time learning what you are going to cover.

3. Set the training norms collaboratively upfront: your expectations from them, their expectations from you should be on the table and any misalignment needs to be handled. Here come issues like late to class, talking instead of doing assignments etc. Discuss course of action if someone oversteps the boundaries that you all have collaboratively set. Agree on how you will handle disagreements if any i.e. agree on how to disagree.

So, basically we attempt to pre-empt rudeness.

If after all of this, someone is rude, then we can take recourse to some of the following strategies:

1. Isolate what form the rudeness is taking: talking amongst themselves, asking irrelevant questions, negative body language, refusal to engage in any of the activities etc.

2. If the rude participants are in a group, split up the group by doing an activity in which you shift people around in the room. My favourite is to use numbers to divide people into groups as it ensures people who are sitting together are not in the same group.

3. Move the rude participants to the front of the room. Basically near you. Now shower them with your keen attention.

4. Redirect their attention by making them participate in the training activities. Use persuasion.

5. For one off comments, say “interesting point of view, lets discuss in the tea break”, and move on without getting affected.

6. If they are asking questions or expressing views, give the participant a patient hearing and try to see it from their perspective. Let them fully express themselves, then if the question is pertinent to the topic answer it. You can also ask for their permission to park the question and answer it later. If they feel heard they will allow that.

7. Be assertive. Tell them that while you appreciate their views, you have differing views. You could also say that since their concern is not the concern of the majority you will handle it post the session.

8. If time is not permitting then tell them you will discuss it with them in the break. Then do not forget to do so.

9. Do not let it get personal. It should not be your view vs. theirs. Ask other participants for their take on the issue / question. Then wrap up with summarizing the views.

10. Humour if used appropriately, can work wonders.

### LightMeUp – Flashlight Application for Android

Posted on: May 16, 2014

• In: Applications
• Comments Off on LightMeUp – Flashlight Application for Android

LightMeUp – Flashlight Application for Android

It is a small application which uses the Camera Flash to enlighten and which may also help you in searching something in dark. The best part is it works in a single click on  your Android phone with or without flash. If your phone does not have flash, it will set brightness of your phone to maximum, as soon as you close application it will set brightness back to original.

This application was developed as a part of Android Training we provide at AnCyber, Pune (India).

### Seminar on Android in Pune

Posted on: January 20, 2014

Conducted Seminat on Android at Pimpari Chinchwad Polytechnic, Pune on 10th Jan. 2014 between 2 pm to 4 pm.

It was great to share knowledge and experience with such a good and enthusiastic crowd.