0% found this document useful (0 votes)
24 views

The Programming Project Isc Computer Science Practical Specimen Paper Solved 2020 Question 1 Evil Number

Uploaded by

onlyfreebees
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

The Programming Project Isc Computer Science Practical Specimen Paper Solved 2020 Question 1 Evil Number

Uploaded by

onlyfreebees
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python,C,C++ and JAVA programs for CBSE, ISC, B.Tech and I.

T Computer Science and MCA students


More Create Blog Sign In

The Programming Project


JAVA, Python, C++ and C programs for students. Here you will also find solutions to boards papers of ISC Computer Science Practical and CBSE Computer Science. ISC
and ICSE JAVA PROGRAMS

Home ISC Computer Science Practical Solved ISC Computer Science Theory Programs ICSE JAVA Programs Project Euler Solutions

Telegram

Share

Search This Blog

Tuesday, March 19, 2019 Search

ISC COMPUTER SCIENCE PRACTICAL SPECIMEN PAPER SOLVED 2020 QUESTION 1 : Maths on Facebook
EVIL NUMBER Maths on YouTube
Maths

NOTE: This question is from a SPECIMEN PAPER released by the council


About Me
An Evil number is a positive whole number which has even number of 1’s in its binary equivalent. Example: Binary equivalent of 9 is Vinod Singh
1001, which contains even number of 1’s. Thus, 9 is an Evil Number. A few Evil numbers are 3, 5, 6, 9.... Design a program to accept
a positive whole number ‘N’ where N>2 and N<100. > <100. Find the binary equivalent of the number and count the number of 1s in Vinod Singh M.Sc Pure
Mathematics., Calcutta
it and display whether it is an Evil number or not with an appropriate message. Test your program with the following data and some
University (First Class) B.Sc
random data:
Mathematics., St. Xavier's
College Kolkata (First Class) Contact No. :
+91-9038126497
Example 1:
View my complete profile
INPUT: N = 15
BINARY EQUIVALENT: 1111
NUMBER OF 1’s: 4 JAVA, C++, C, Python and JavaScript for
OUTPUT: EVIL NUMBER students. Here you will also find solutions to
boards papers of ISC Computer Science
Example 2:
Practicals and CBSE Computer Science.
INPUT: N = 26
ISC JAVA PROGRAMS
BINARY EQUIVALENT: 11010
NUMBER OF 1’s: 3
OUTPUT: NOT AN EVIL NUMBER Prime Maths
Example 3: १,१६,१२१ फॉलोअर
INPUT: N = 145
OUTPUT: NUMBER OUT OF RANGE

पेज फॉलो करा शेअर करा

This particualr problem is quite simple. Going through the code will reveal the logic!

import java.util.*;
public class ISC2020Q1 {
public static void main(String[] args) {
int N;
Scanner in = new Scanner(System.in);
do {
System.out.println("Enter the number:");
N = in.nextInt(); Prime Maths
if(N <=2 || N>=100) मिहन्याभरापूवीर्
System.out.println("NUMBER OUT OF RANGE,TRY AGAIN");
Monotonicity of trigonometric function #IIT
}while(N <=2 || N>=100);
#WBJEE #CBSE
EvilNumber obj = new EvilNumber(N);
obj.dsiplay();
in.close();
}
}
Total Pageviews
class EvilNumber {
public void dsiplay() { 283,515
testEvilNumber();
System.out.println("INPUT NUMBER N:"+number);
System.out.println("BINARY EQUIVALENT:"); Followers
for(int i=1;i<=counter;i++)
System.out.print(binary[counter-i]+" ");
System.out.println();
System.out.println("NUMBER OF 1's:"+evil_counter);
if (flag==true)
System.out.print("EVIL NUMBER");
else
System.out.print("NOT AN EVIL NUMBER");
}
private void testEvilNumber() { Blog Archive
int tmp=number;
do { ► 2023 (23)
binary[counter] = tmp%2; ► 2022 (19)
tmp /=2;
► 2021 (22)
counter++;
}while(tmp >=1); ► 2020 (9)
for(int i=0;i<counter;i++) ▼ 2019 (31)
if(binary[i]==1) ▼ March (31)
evil_counter++;
ISC COMPUTER SCIENCE
PRACTICAL SOLVED 2006
if(evil_counter%2==0) QUESTIO...
flag=true;
ISC COMPUTER SCIENCE
} PRACTICAL 2005 SOLVED
EvilNumber(int N) { QUESTIO...
number = N; ISC COMPUTER SCIENCE
binary = new int[7]; // a binary sequence of length 7 ranges from 1 to 127 PRACTICAL 2005 SOLVED
counter = 0; QUESTIO...
evil_counter=0; ISC COMPUTER SCIENCE
flag = false; PRACTICAL 2004 SOLVED
} QUESTIO...
private boolean flag; ISC COMPUTER SCIENCE
private int number; PRACTICAL 2004 SOLVED
private int[] binary; QUESTIO...
private int counter; ISC COMPUTER SCIENCE
private int evil_counter; PRACTICAL 2020 SPECIMEN
} PAPER...
ISC COMPUTER SCIENCE
PRACTICAL 2020 SOLVED
SPECIME...
Posted by Vinod Singh at 7:08 AM
ISC COMPUTER SCIENCE
Labels: CBSE Computer Science, Computer, ISC COMPUTER SCIENCE PRACTICALS, isc java programs, Solved ISC papers PRACTICAL SPECIMEN PAPER
SOLV...
ISC COMPUTER SCIENCE
No comments: PRACTICAL 2003 SOLVED
QUESTIO...

Post a Comment ISC COMPUTER SCIENCE


PRACTICAL 2003 SOLVED
QUESTIO...

Enter Comment ISC COMPUTER SCIENCE


PRACTICAL 2003 SOLVED
QUESTIO...
ISC COMPUTER SCIENCE
Newer Post Home Older Post PRACTICAL 2002 SOLVED
QUESTIO...
Subscribe to: Post Comments (Atom) ISC COMPUTER SCIENCE
PRACTICAL 2002 SOLVED
QUESTIO...
ISC COMPUTER SCIENCE
PRACTICAL 2001 SOLVED
QUESTIO...
ISC COMPUTER SCIENCE
PRACTICAL 2001 SOLVED
QUESTIO...
ISC COMPUTER SCIENCE
PRACTICAL 2001 QUESTION 1 :
L...
ISC COMPUTER SCIENCE
PRACTICAL 2019 QUESTION 3 :
S...
ISC COMPUTER SCIENCE
PRACTICAL 2019 QUESTION 2 :
M...
ISC COMPUTER SCIENCE
PRACTICAL 2019 QUESTION 1 : ...
ISC COMPUTER SCIENCE
PRACTICAL 2016 QUESTION 3 :
S...
ISC COMPUTER SCIENCE
PRACTICAL 2016 QUESTION 2 :
M...
ISC COMPUTER SCIENCE
PRACTICAL 2016 QUESTION 1 :
C...
ISC COMPUTER SCIENCE
PRACTICAL 2017 QUESTION 3
CAE...
ISC COMPUTER SCIENCE
PRACTICAL 2017 QUESTION 2
ISC COMPUTER SCIENCE
PRACTICAL 2017 QUESTION 1
CAR...
ISC COMPUTER SCIENCE
PRACTIACL 2018 QUESTION 3
TEA...
ISC COMPUTER SCIENCE
PRACTICAL 2018 QUESTION 2 : (...
ISC COMPUTER SCIENCE
PRACTICAL 2018 QUESTION 1
ISC COMPUTER SCIENCE
PRACTICAL 2015 QUESTION 3
ISC COMPUTER SCIENCE
PRACTICAL 2015 QUESTION 2
ISC COMPUTER SCIENCE
PRACTICAL 2015 Question 1

► 2014 (87)
► 2013 (63)
► 2012 (7)

Powered by Blogger.

You might also like