In Java, checking whether a number is a perfect square or not is a common task. A number is called a perfect square if it can be expressed as the product of an integer with itself. For example, 16 is a perfect square because it is the result of multiplying 4 × 4. In this article...
Python program to print perfect numbers from the given list of integers # Define a function for checking perfect number# and print that numberdefcheckPerfectNum(n):# initialisationi=2sum=1# iterating till n//2 valuewhilei<=n //2:# if proper divisor then add it.ifn % i==0:sum+=...
//C# program to check the given number is a//perfect number or not.usingSystem;classCheckPerfect{staticboolIsPerfect(intnumber){intsum=0;intiLoop=0;for(iLoop=1;iLoop<number;iLoop++){if(number%iLoop==0)sum=sum+iLoop;}if(sum==number){returntrue;}returnfalse;}staticvoidMain(string[]args)...
classJavaExample{//method for checking prime numberstaticintcheckPrime(intnum){inti,flag=0;for(i=2;i<=num/2;i++){if(num%i==0){flag=1;break;}}/* If flag value is 0 then the given number num * is a prime number else it is not a prime number */if(flag==0)return1;elsereturn...
Java Code Editor: Improve this sample solution and post your code through Disqus Java Lambda Exercises Previous:Java program to check if a list contains a specific word using lambda expression. Java Lambda Exercises Next:Java program to check if a number is a perfect square using lambda expressio...
Any function that can be programmed in Java (meaning just about any function) may be programmed and downloaded to an OCAP host. However, unlike bound and unbound applications, native applications are not guaranteed to run on any host. Native applications are written for a particular host. ...
The main() calls the findduplicate(char *s) to find the repeated characters in the string. The function findduplicates(char *s) a)For loop iterates through the string b)If the element of the string is not a ‘*’ then compare the element with the next elements to it. If matched the...
for(i=0;i<n;i++) { if(a[i]!=-1) { printf("no of %d is %d \n",a[i],b[i]); } } } intmain() { inta[10000],b[10000],i,n; printf("Enter size of the array : "); scanf("%d",&n); printf("Enter elements in array : "); ...
10 built-in brushes – four round ones, four square ones, and two made up of a number of separate pixels. Dot tool – allows fast freehand drawing. Note, however, that the faster you go, the bigger the gaps in your drawing. It can be handy to use and see the shape of a customiz...
a first competition processing module configured to perform a first competition process for progressing the competition game in the first period based on the set athletic field formations used by the first player and the second player in the first period and the game content information on the game...