Page 192 - CA_Blue( J )_Class10
P. 192
19. A tech number has even number of digits. If the number is split into two equal halves, then the square of the sum of these
halves is equal to the number itself. Write a program to generate and print all four digits tech numbers.
Example:
Consider the number 3025.
Square of sum of the halves of 3025 = (30 + 25) 2
= (55) 2
= 3025 is a tech number. [2019]
Ans. import java.util.*;
class technumber
{
public static void main()
{
int i,r,s,q;
System.out.print("The Tech numbers are : ");
for(i = 1000; i <= 9999; i++)
{
q = i/100;
r = i%100;
s=q+r;
if((s*s)==i)
System.out.print(i + "\t");
}
}
}
20. Write a program to input a number and check and print whether it is a Pronic number or not. Pronic number is the number
that is the product of two consecutive integers.
Examples:
12 = 3 × 4, 20 = 4 × 5, 42 = 6 × 7 [2018]
Ans. import java.util.*;
class Pronic
{
public static void main ()
{
Scanner sc= new Scanner (System.in);
int n, i, f=0;
System.out.print("Enter the number: ");
n = sc.nextInt();
for(i=1;i<=n; i++)
{
if(i * (i + 1) == n)
{
f=1;
break;
}
}
if(f==1)
System.out.println(n + " is a Pronic Number.");
else
System.out.println(n + " is not a Pronic Number.");
}
}
21. Write a program in Java to accept a string in lowercase and change the first letter of every word to uppercase. Display the new
string.
Sample INPUT: we are in cyber world
Sample OUTPUT: We Are In Cyber World [2018]
190190 Touchpad Computer Applications-X

