IBM
Company
Programming
Program
wap to find desired character in the string and find ascii value in java
Read Solution (Total 12)
-
- import java.io.IOException;
import java.util.*;
public class ibmchstr {
public static void main(String args[]) throws IOException{
Scanner sc=new Scanner(System.in);
int x=0;
System.out.println("enter the string");
String s=sc.nextLine();
System.out.println("enter the char to search");
char ch=(char)System.in.read();
for(int i=0;i - 7 years agoHelpfull: Yes(2) No(2)
- import java.io.*;
import java.lang.*;
public class CharToASCII{
public static void main(String args[]) throws IOException{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the char:");
String str = buff.readLine();
for ( int i = 0; i < str.length(); ++i ){
char c = str.charAt(i);
int j = (int) c;// your work is done here
System.out.println("ASCII OF "+c +" = " + j + ".");
}
}
} - 7 years agoHelpfull: Yes(2) No(0)
- import java.io.*;
import java.lang.*;
public class CharToASCII{
public static void main(String args[]) throws IOException{
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the char:");
String str = buff.readLine();
for ( int i = 0; i < str.length(); ++i ){
char c = str.charAt(i);
int j = (int) c;// your work is done here
System.out.println("ASCII OF "+c +" = " + j + ".");
}
}
} - 7 years agoHelpfull: Yes(1) No(0)
- @Vicky after that
- 7 years agoHelpfull: Yes(0) No(0)
- @ashish nayak i had posted full solution but i dono why its look lk this
- 7 years agoHelpfull: Yes(0) No(0)
- OK can you please mail me ashish.al19@gmail.com
- 7 years agoHelpfull: Yes(0) No(0)
- @vicky please send me that code ashish.al19@gmail.com
- 7 years agoHelpfull: Yes(0) No(0)
- public JavaApplication() {
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the String");
String s = sc.nextLine();
int count = (s.length()) + 1;
System.out.println("Enter the character");
char c = sc.next().charAt(0);
//Character c=new Character('a');
for (int i = 0; i < s.length(); i++) {
if (c == s.charAt(i)) {
System.out.println("yes it is present");
int j = (int) c;
System.out.println("Your ASCII Value " + j);
count--;
}
if (count == 0) {
System.out.println("it is not present");
}
}
}
} - 7 years agoHelpfull: Yes(0) No(0)
- don't they prefer c language?
- 6 years agoHelpfull: Yes(0) No(0)
- import java.util.*;
import java.io.*;
import java.lang.*;
public class DesiredChar
{
public static void main (String[] args)
{
int position=0;
System.out.println("Enter The String: ");
Scanner sc=new Scanner(System.in);
String str=sc.nextLine();
System.out.println("Enter The Character to find: ");
char ch=sc.next().charAt(0);
position=str.indexOf(ch);
if(position>=0)
{
System.out.println("The position of "+ch+" is "+(position));
System.out.println("THe Ascii value of "+ch+" is "+(int)ch);
}
else
System.out.println(ch+" is not Present in the Given string");
}
} - 5 years agoHelpfull: Yes(0) No(0)
- import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner sc= new Scanner (System.in);
String str=sc.nextLine();
char ch= sc.next(".").charAt(0);
System.out.println(ascii(str,ch));
}
static int ascii (String str,char ch)
{
for (int i=0;i - 5 years agoHelpfull: Yes(0) No(0)
- import java.util.Scanner;
public class Main
{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
String name=sc.nextLine(); //input of a string
char n = sc.next().charAt(0); //input of the string you need to find
int val=name.indexOf(n);
if(val != -1){
System.out.println("present");
System.out.println((int)n);
}else{
System.out.println("no");
}
}
} - 4 years agoHelpfull: Yes(0) No(0)
IBM Other Question
Which of the following is an example of understanding the rules and behaviors of email communication?
– Formality
– Content
– Writing skills
– Language
I attended the drive on 1 feb. 2017.
1.) 28,17,23,17,26,16,22,16,24,15,21,15
2.) 1/5,1/2,1/3,2/5,1,2/3,3/5,11/2,1,4/5
3.) -3,-6,-9,-82,-80,-30,-33,-36,-55,-53,-24
4.) 34.274,34.2744,34.2784,34.3184
5.) 8,16,3,27,4,8,7,19,2,0,7
6.) -3,6,1,-2,4,-1,-1,2,-3
7.) 2,3,10,15,26
8.) 0.03,0.0018,0.00108,0.00648,0.3888
9.) 0,1,2,0.5,2,3,5,1,2,0,2,1,4,2,3
10.) 1.4,2.4,2.4,4.4,8.8,11.8,35.4,39.4
11.) 5,5,7,7,9,11,11,13,13,17,17,15,19,17
12.) 2,1,2,3,8,0,1,9,1,2
13.) 37,73,9,49,58,85,25,64,29,92
14.) 3,5,2,3.5,7,4,6,3,4.5,9,1.5
15.) 2,1,2,3,2,9,9,0,1,1,9
16.) 36,42,16,20,36,42,4
17.) 11,8,17,14,23,24,31,32,35
18.) 25,13,39,17,51,19,57,15,45