<SCRIPT LANGUAGE="VBSCRIPT">
DIM i,n,j
n = 100
DOCUMENT.WRITE("Prime nos are")&space(1)&"1"&space(2)&"2"&space(2)
X=0
FOR j = 3 TO n
FOR i = 2 TO (j-1)
IF i MOD j <> 0 THEN
DOCUMENT.WRITE(i)&space(2)
X=1
END IF
NEXT
NEXT
<html> <script language="vbscript"> n=cint(inputbox("Enter a number")) dim f f=1 if n<0 then Msgbox "Invalid number" elseif n=0 or n=1 then MsgBox "The factorial of given number "&n&" is :"&f else for i=n to 2 step -1 f=f*i next MsgBox "The factorial of given number "&n&" is :"&f end if </script> </html>
The prime factors of 24 are 2 and 3.
To find the greatest number among a set of numbers provided as command line arguments in a Shell script, you can use a loop to iterate through the arguments. Here's a simple example: #!/bin/bash greatest=$1 for num in "$@"; do if (( num > greatest )); then greatest=$num fi done echo "The greatest number is: $greatest" Save this script as find_greatest.sh, make it executable with chmod +x find_greatest.sh, and run it by passing numbers as arguments, like ./find_greatest.sh 3 5 1 8.
To write a C program to find prime numbers between 1 to 500, you can use a nested loop structure. In the outer loop, iterate from 2 to 500, and in the inner loop, check if the number is divisible by any number from 2 to the square root of the number. If it is not divisible by any number other than 1 and itself, then it is a prime number. Print out all prime numbers found within the specified range. Remember to include necessary header files, such as <stdio.h>, and use appropriate logic to implement the program efficiently.
flow chart to find whther the given number is perfect or not
//some students also asked it with alert dialog box ! I have done it in a HTML page 100% working best of Luck !_Z triplezero here :) <script type="text/javascript"> var inum, icount=2; var irem; inum = prompt("Enter a number."); if(inum==1) { alert("The no. is not prime"); document.write("The no. is not prime"); exit(0); } if(inum==2) { alert("The no. is prime"); document.write("The no. is prime"); exit(0); } do { irem=inum%icount; if(irem==0) { alert("The no. is not prime"); document.write("the given no is not prime"); exit(0); } icount++; } while(icount<=(inum/2)); alert("The no. is prime"); document.write("the given number is prime"); </script>
17,017
By dividing it by the prime factors that have no remainders
To find twin primes of a given number, iterate through the numbers starting from the given number, and for each number, check if both the number and the number+2 are prime. If they are, then they form a pair of twin primes with the given number.
A number which is divisible by itself and 1 is called prime number. A prime number has only two factors.But, 836475 is also divisible by5, i.e. 836475 has more than two factors.Therefore, the given number is not prime.In order to show that given number is not prime there is no need to find all the factors, we should show that given number has more than two factors.
Prime numbers have two and only two factors. If the number has more than two factors, it is not prime.
you see if it can be divided by any numbers that are not 1 or itself
#include<stdio.h> #include<conio.h> void main() { int n,a=2; clrscr(); printf("\n enter n"); scanf("%d",&n); if(i<=a-1) { if(a%i==0) { printf("\n the given number is not a prime number"); break; } i++; if(a==i) { printf("\n the given number is a prime number"); } getch(); output: enter the value of n:2 the given number is prime number
they can help you by finding the two factors of the number given
Sure, since there are INFINITELY MANY prime numbers, that means you will find prime numbers over any given number.
As people have been trying to find a script of some sort using the most powerful computers in the world for 60 years to no result, so no one can assist you in this question yet...
Start with the lowest prime factors 2, 3, 5, 7 etc and work up.