-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumber13.java
More file actions
40 lines (38 loc) · 852 Bytes
/
Number13.java
File metadata and controls
40 lines (38 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.*;
public class Number13 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n,i,j=0;
System.out.println("Enter the total no. of questions asked: ");
n=sc.nextInt();
String a[]=new String[n];
String b[]=new String[n];
for(i=1;i<=n;i++)
{
System.out.println("Enter asker’s and coordinator’s name for "+i+(alpha(i))+" one");
a[j]=sc.next();
b[j++]=sc.next();
}
System.out.println("Asker "+"\t\t\t\t"+"Query Solved by");
for(i=0;i<j;i++)
{
System.out.println(a[i]+"\t\t\t\t "+b[i]);
}
}
static String alpha(int i)
{
if(i%100==11||i%100==12||i%100==13)
return "th";
else
{
if(i%10==1)
return "st";
else if(i%10==2)
return "nd";
else if(i%10==3)
return "rd";
else
return "th";
}
}
}