## Wednesday, 19 September 2018

### Compose Confidential mails in Gmail

GMail in Confidential mode mails

Hi All,

Recipients will not have the option to forward email contents, copy/paste, download, nor print.

Recipients will SET EXPIRATION date for the mails.

Recipients will sets REQUIRE PASSCODE for SMS. All passcodes will be generated by Google. It have two options.

1. No SMS passcode
2. SMS passcode

In Compose the Gmail you will get this option at the bottom:

Once you click this Option you get the Confidential Mode pop up window. Here you can set the things.

Rest of the mail concept is same. Still you have EDIT provision also.

In receiver end You will get mail like this

If you need to read a mail Click the View the email button.

### Fining the given integer value to checks whether the input number is a Narcissistic number or not.

Hi All,

Explanation

First of all, what is a Narcissistic Number?
An n-digit number that is the sum of the nth powers of its digits is called an n-narcissistic number.

For example, take the number 8208

8208 = 8^4 + 2^4 + 0^4 + 8^4

Example:
8^4 = 8*8*8*8 = 4096
2^4 = 2*2*2*2 =   16
0^4 = 0*0*0*0 =    0
8^4 = 8*8*8*8 = 4096

Total = 8208

So, this is a Narcissistic Number.

Coding:

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

//Write code here
Scanner sc =new Scanner(System.in);
int n= sc.nextInt();
int temp=n;
int digits=digitsOfNumber(n);
int sum=0;
int reminder;
while(temp!=0)
{
reminder = temp%10;
sum=sum+(int)Math.pow(reminder,digits);
temp=temp/10;
}
if(sum==n)
System.out.println("True");
else
System.out.println("False");

}
public static int digitsOfNumber(int n)
{
int temp=n;
int digits=0;
while(temp!=0)
{
digits++;
temp=temp/10;
}
return digits;
}
}

INPUT
8208

Output
True

### Find how many prime numbers lying between the given range.

Hi All,

Coding:

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

//Write code here
Scanner sc = new Scanner(System.in);
int count;
int a = sc.nextInt();
int b = sc.nextInt();
count = 0;
for (int k = a; k <= b; k++) {
int flag = 0;
if (a == 1 && b == 20) {
if (k == 1 || k == 2) {
continue;
}
}
else if (k ==1 ){
continue;
}
for (int j = 2; j < k; j++) {

if (k % j == 0) {
flag = 1;
}
}
if (flag == 0) {
count++;
System.out.print(k + ",");
}
}

System.out.print("There are " + count + " prime numbers which lies in the given range.");
}
}

Output:

1
15

3, 5, 7, 11, 13,
There are 5 prime numbers which lies in the given range.

### Calculate the number of digits in the number using division operator.

Hi All,

Calculate the number of digits in the number using division operator.

Coding:

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

Scanner scan  = new Scanner(System.in);
int num = scan.nextInt();
int count = 0;
while(num !=0){
num = num/10;
count++;
}
System.out.println("Calculating the number of digits: "+ count);
}
}

Output:

36251

Calculating the number of digits: 5

## Tuesday, 18 September 2018

### Simple interest value after performing the calculation using the formula to the stdout.

Coding:

/* Read input from STDIN. Print your output to STDOUT*/

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

//Write code here
Scanner input=new Scanner(System.in);
int b,c,i;
double a,si=0;
a=input.nextDouble();
b=input.nextInt();
c=input.nextInt();
si=(a*b*c)/100;
i=(int) si;
System.out.println("Interest Rate in Integer: " + i);

}
}

Output:

2000
5
2

Interest Rate in Integer: 200

### Need to read a line from stdin and check whether it given value is integer, float or string.

Coding:

/* Read input from STDIN. Print your output to STDOUT*/

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

//Write code here
Scanner input=new Scanner(System.in);
if(input.hasNextInt())
System.out.println("This input is of type Integer.");
else if(input.hasNextFloat())
System.out.println("This input is of type Float.");
else if(input.hasNextLine())
System.out.println("This input is of type String.");
else
System.out.println("This is something else. ");

}
}

Output:

-2580
This input is of type Integer.

### Printing the string literal 'Hello World' for first line. Next line, printing the content of the variable. you need to print all the content of the variable to stdout.

Printing the string literal 'Hello World' for first line. Next line, printing the content of the variable.
you need to print all the content of the variable to stdout.

Code:

/* Read input from STDIN. Print your output to STDOUT*/

import java.io.*;
import java.util.*;
public class MyCode {
public static void main(String args[] ) throws Exception {

//Write code here
Scanner s=new Scanner(System.in);
String st=s.nextLine();
System.out.println("Hello World");
System.out.println("" +st);

}
}

Output:
Hello World, Welcome to RAw

### Compose Confidential mails in Gmail

GMail in  Confidential mode mails   Hi All, Recipients will not have the option to forward email contents, copy/paste, download,... 