Program Number 1:
A smith number is a composite number, the sum of whose digits is the sum ofthe digits of its prime factors obtained as a result of prime factorization
(excluding 1). The first few such numbers are 4, 22, 27, 58, 85, 94, 121 …
Example;
1. 666
Prime factors are 2, 3, 3 and 37
Sum of the digits are (6+6+6) = 18
Sum of the digits of the factors (2+3+3+(3+7) = 18
2. 4937775
Prime factors are 3, 5, 5, 65837
Sum of the digits are (4+9+3+7+7+7+5) = 42
Sum of the digits of the factors (3+5+5+(6+5+8+3+7) = 42
Write a program to input a number and display whether the number is a Smith number or not.
Sample data:
Input 94 Output SMITH Number
Input 102 Output NOT SMITH Number
Input 666 Output SMITH Number
Input 999 Output NOT SMITH Number
Codes of Smith Number Program
is previously posted in this blog.
Program Number 2
A sentence is terminated by either “ . ” , “ ! ” or “ ? ” followed by a space. Input a piece of text consisting of sentences. Assume that there will be a maximum of 10 sentences in a block.
Write a program to:
(i) Obtain the length of the sentence (measured in words) and the frequency of vowels in each sentence.
(ii) Generate the output as shown below using the given data
Sample data:
INPUT
HELLO! HOW ARE YOU? HOPE EVERYTHING IS FINE. BEST OF
LUCK.
OUTPUT
Sentence No. of Vowels No. of words
----------------------------------------------------------
1 2 1
2 5 3
3 8 4
4 3 3
Codes of the program
ISC 2019 English Paper II Suggestions (New Syllabus): CLICK HERE
import java.io.*;
import java.util.*;
class Sentence
{
String str1,str2,str3[];
int number,i;
StringTokenizer stk;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
public void takeSentence()throws Exception
{
System.out.println("Enter the sentence:");
str1=br.readLine();
stk=new StringTokenizer(str1,"?.,");
number=stk.countTokens();
str3=new String[number];
i=0;
while(stk.hasMoreTokens())
{
str3[i++]=stk.nextToken();
}
System.out.println("\nSentence No No. of vowels No. of words\n");
for(i=0;i< number;i++)
{
str1=str3[i];
System.out.print((i+1)+" ");
System.out.print(vowel(str1)+ " ");
System.out.println(word(str1)+ " ");
}
}
private int vowel(String s)
{
int i,v=0,len;
len=s.length();
s=s.toUpperCase();
for(i=0;i< len;i++)
{
if(s.charAt(i)=='A'||s.charAt(i)=='E'||s.charAt(i)=='I'||s.charAt(i)=='O'||s.charAt(i)=='U')
v++;
}
return v;
}
private int word(String s)
{
int i,v=1,len;
len=s.length();
s=s.toUpperCase();
for(i=0;i< len;i++)
{
if(s.charAt(i)==' ')
v++;
}
return v;
}
public static void main(String args[])throws Exception
{
Sentence object=new Sentence();
object.takeSentence();
}
}
Program Number 3
Given a square matrix list [ ] [ ] of order ‘ n ’. The maximum value possible for ‘ n ’ is 20. Input the value for ‘ n ’ and the positive integers in the matrix and perform the following task:
1. Display the original matrix
2. Print the row and column position of the largest element of the matrix.
3. Print the row and column position of the second largest element of the
matrix.
4. Sort the elements of the rows in the ascending order and display the new matrix.
Sample data:
INPUT
N = 3
List [] [ ]
5 1 3
7 4 6
9 8 2
OUTPUT
5 1 3
7 4 6
9 8 2
The largest element 9 is in row 3 and column 1
The second largest element 8 is in row 3 and column 2
Sorted list
1 3 5
4 6 7
2 8 9
Also Read: Computer Teacher in Burdwan
Codes of this program on array
import java.io.*;
class ArrayProgram
{
int array[][]=new int[3][3];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,j;
public void take() throws Exception
{
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
System.out.print("Enter Number:");
array[i][j]=Integer.parseInt(br.readLine());
}
}
System.out.println("\nValues as follows\n");
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
System.out.print(" "+array[i][j]);
}
System.out.println();
}
sort();
System.out.println("\nValues as follows after sorting row wise\n");
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
System.out.print(" "+array[i][j]);
}
System.out.println();
}
display();
}
private void sort()
{
int k,temp;
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
for(k=j+1;k< 3;k++)
{
if(array[i][j] >array[i][k])
{
temp=array[i][j];
array[i][j]=array[i][k];
array[i][k]=temp;
}
}
}
}
}
private void display()
{
int max1=0,max2=0,maxi=0,maxj=0;
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
if(array[i][j] >max1)
{
max1=array[i][j];
maxi=i+1;
maxj=j+1;
}
}
}
System.out.println("Maximum value="+max1 + " and the row and column numbers are:"+maxi+","+maxj);
for(i=0;i< 3;i++)
{
for(j=0;j< 3;j++)
{
if(array[i][j] >max2 && array[i][j]< max1)
{
max2=array[i][j];
maxi=i+1;
maxj=j+1;
}
}
}
System.out.println("2nd Maximum value="+max2 + " and the row and column numbers are:"+maxi+","+maxj);
}
public static void main(String args[])throws Exception
{
ArrayProgram object=new ArrayProgram();
object.take();
}
}
Similar Posts: ISC Computer Practical Programs - 2006
ISC 2007 Computer Practical Paper
ISC 2010 Computer Practical
ISC 2011 Computer Practical solved paper
plz post 2005 & 2004 question paper
ReplyDeleteISc 2005 practical solved paper posted today. ISC 2004 will be posted on tomorrow.
ReplyDeleteplz post lucky number of 2001 plz plz plz
ReplyDeleteyour question is not clear to me. Please elaborate.
ReplyDeletethat person wants you to post the answer for a question in 2001 ISC practical,which is about lucky number.
ReplyDeletesir can u plz give suggestions on comp practical paper for 2012.
ReplyDeletePlease go through the computer practical papers from 2005 to 2011 and you will get some idea.
Deletesir, is date/time programs expected this year?
ReplyDeleteSince last 2-3 years, date/time related programs are coming.
Deletematrix multiplication important? for isc 2012?
ReplyDeleteI do not think so.
DeleteShorter program on number to words
ReplyDeleteimport java.util.*;
class words
{
public static void main(String args[])throws Exception
{
Scanner St=new Scanner(System.in);
String S[]={"ZERO","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN","ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN","SIXTEEN","SEVENTEEN","EIGHTEEN","NINETEEN","TWENTY","THIRTY","FORTY","FIFTY","SIXTY","SEVENTY","EIGHTY","NINETY"};
System.out.println("enter a no.");
int n=St.nextInt();
int i,c=0,a,b,d;
if (n>=1000)
{
System.out.println("OUT OF RANGE");
System.exit(0);
}
if (n<=20)
{
System.out.println(S[n]);
System.exit(0);
}
for (i=n;i!=0;i=i/10)
c++;
if (c==2)
{
a=n%10;
b=n/10;
System.out.print(S[18+b]);
if (a!=0)
System.out.print("\t"+S[a]);
}
else if (c==3)
{
a=n/100;
b=(n/10)%10;
d=n%10;
System.out.print(S[a]+" "+"HUNDRED"+" ");
if (((b*10)+d)!=0&&((b*10)+d)<21)
System.out.print(S[(b*10)+d]);
else if (((b*10)+d)!=0&&((b*10)+d)>20)
System.out.print(S[18+b]+" "+S[d]);
}
}
}
.........but complex
sir,is spiral array expected this year?
ReplyDeleteMany students like you have asked about spiral matrix. So, you can expect this program.
Deletecan you do this program without using string tokenizer
ReplyDeleteIt should be the second program. I will post it very soon.
Deletesir i want know important of isc 2018 practical
ReplyDeleteYou have to answer only one question so concentrate more on String class related programs. Simply go through last 4-5 years questions and you will definitely get similar program. Best of Luck
Delete