In an entrance examination, students have been appeared in English, Maths and Science papers. Write a program to calculate and display average marks obtained by all the students. Take number of students appeared and marks obtained in all three subjects by every student along with the name as inputs. Display the name, marks obtained in three subjects and the average of all the students.
Write a program to input two numbers and check whether they are twin prime numbers or not. Computer Network. Compiler Design. Computer Organization. Discrete Mathematics. Ethical Hacking. Computer Graphics. Software Engineering. Web Technology. Cyber Security. C Programming. Control System. Data Mining. Data Warehouse. Javatpoint Services JavaTpoint offers too many high quality services. A prime number is a number that is divisible by only one or itself. Let's take some examples of PalPrime numbers.
Steps to check PalPrime number In order to check whether the number is PalPrime or not, we have to follow the following steps: Get a number from the user to check whether it is PalPrime or not. To fix this, make a copy of sPrime at the top of the method and compare the copy to reverse. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years, 4 months ago. Active 4 years, 11 months ago. Viewed 5k times. Thanks, Ben import java.
Improve this question. Pokechu22 4, 8 8 gold badges 36 36 silver badges 60 60 bronze badges. Add a comment. Active Oldest Votes. You could really improve both functions: Some notes about IsItPrime : Check first only for even numbers you are doing this The for-loop could begin in 3 and increment by 2, to check only odd numbers, the even are checked in the previous point. The for-loop only needs to check from It would be a prime if the number is less or equal to sqrt N and devides N.
Improve this answer. Luis Rita 5 5 bronze badges. Thank you so much, it runs perfectly!
0コメント