Study guides

Q: Program for print prime all number from 1 to 100 in foxpro?

Write your answer...

Submit

Still have questions?

Related questions

An infinite number of pages are required to print an infinitely large prime number.

10 input "enter a no."; n 20 for i = 1 to n 30 if n mod i = 0 then c = c +1 40 next i 50 if c = 2 then print "prime number" else print "not a prime number" 60 end

CLS PRINT "PROGRAM: Find if number is odd/or, even" PRINT INPUT "Enter number: ", number$ number% = VAL(number$) PRINT PRINT "The number is "; IF number% MOD 2 = 0 THEN PRINT "even." ELSE PRINT "odd." END IF END

Begin Read num for(i=2; i<num; i++) if(num%2==0) then print "the number is not a prime no."; else if print "the number is prime"; end if Stop

PRINT 2,3,5,7,11,13,17,19,23,29,31,37

CLS PRINT "PROGRAM: Print squares of all even numbers from 1 to 20" PRINT PRINT "number", "squared" PRINT FOR number% = 1 TO 20 IF number% MOD 2 = 0 THEN PRINT number%, number% * number% END IF NEXT END

int n=<desired number>; int i=2; // using 2 because every no is divisible by 1 boolean prime=false; loop : while(i<n){ if(n%i==0){ prime = true; break loop; } i++; } System.out.println(prime); // prints true if no is prime, false if it's not

puts ("2 3 5 7 11 13 17 19 23 29");

It is type-dependent: for 'int': printf ("%d", prime); for 'long': printf ("%ld", prime); for 'long long': printf ("%lld", prime);

bghjg

import java.util.*; class Prime { public static void main(String s[]) { int a,c=0; Scanner sc=new Scanner(System.in); System.out.println("enter a number"); a=sc.nextInt(); for(int i=1;i<=a;i++) if(a%i==0) c++; if(c==2) System.out.println("prime number"); else System.out.println("not a prime number"); } }

Private Sub Command1_Click() Dim I, N As Integer N = Val(Text1.Text) For I = 2 To N - 1 If N Mod I = 0 Then Print "THE NUMBER IS NOT A PRIME NUMBER" Exit Sub End If Next I Print "THE NUMBER IS A PRIME NUMBER" End Sub Private Sub Command2_Click() Text1.Text = "" Text1.SetFocus End Sub Private Sub Command3_Click() End End Sub

You can try the below FoxPro code: Report Form "C:\Project\Reports\PrintReport" Preview Report Form "C:\Project\Reports\PrintReport" To Printer Prompt Nodialog Preview

What is the number of an array<question mark>

CLS PRINT "PROGRAM: Add up 10 numbers entered from the keyboard;" PRINT " then, printout their sum total." PRINT sumTotal = 0 FOR eachNo% = 1 TO 10 IF eachNo% < 10 THEN PRINT " "; PRINT eachNo%; "> "; INPUT "Enter number: ", number sumTotal = sumTotal + number NEXT PRINT PRINT "The sum total of your 10 numbers is: "; sumTotal END

/* Program to print prime numbers up to given number */ import java.util.*; public class Prime { public static void main(String args[]) { Scanner sc=new Scanner(System.in); System.out.println("Enter the number : (it prints prime numbers upto your given number)"); int n=sc.nextInt(); System.out.println("The Prime number upto "+n+" are : "); while (n>=0) { int count=0; for (int i=1;i<=n ;i++) { if (n%i==0) { count++; } } if (count==2) { System.out.print(n+" "); } n--; } } }

#include<iostream.h> #include<conio.h> int main() { clrscr(); cout<<"PROGRAM TO CHECK IF THE NUMBER IS PRIME OR NOT:"<<endl; cout<<"Enter a number:"; int n; cin>>n; for(int i=2;i<n;i++) { if(n%i==0) { cout<<"THE NUMBER IS NOT PRIME"<<endl; } } if(i==n) { cout<<"THE NUMBER IS PRIME"<<endl; } else { exit(1); } getch(); return 0; } Note: the exit(1) statment needs protype and on not prime numbers it execute the full loop and print the result like this enter the number n=6 the number is not prime the number is not prime the number is prime instead of it try this code with a little modification . i aknowledge your work. #include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<"PROGRAM TO CHECK IF THE NUMBER IS PRIME OR NOT:"<<endl; cout<<"Enter a number:"; int n; cin>>n; for(int i=2;i<n;i++) { if(n%i==0) { cout<<"THE NUMBER IS NOT PRIME"<<endl; goto g1; } } if(i==n) { cout<<"THE NUMBER IS PRIME"<<endl; } g1: getch(); }

Write a program enters the ten-digit number and prints Using the largest for

I suggest you write an outer loop, that loops through all the numbers from 1 to 50. Call the variable that controls the loop something like "number".Then, initially assume the number is a prime (with a variable such as "isprime"); and write another loop that compares whether the number is divisible by any number from 2 to number-1. Call the controlling variable "factor". If number is divisible by factor, then it is not a prime, and you can exit the loop. At the end of the inner loop, if the variable "isprime" is still true, then you print the number.

#includ<iostream.h> int main () { int n,n-1; for(n=0); cout<<"the number is even:"<<endl; if(n=n-1) cout<<"the number is prime:"<<endl; getch 0; return 0; }

You can do this easily in a "for" loop. The relevant part of the program looks like this: for (number = 1; number <= 100; number++){ System.out.println(number); }

Yes, please do write.

wap to print all the arnstrong no. between 100&1000

num1% = 0 num2% = 0 num3% = 0 highestNum% = 0 CLS PRINT "PROGRAM: Find the highest number" PRINT INPUT "Enter the first number: ", num1% highestNum% = num1% INPUT "Enter the second number: ", num2% IF num2% > highestNum% THEN highestNum% = num2% INPUT "Enter the third number: ", num3% IF num3% > highestNum% THEN highestNum% = num3% PRINT PRINT "The largest number you entered was: "; highestNum% END

Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.

People also asked