TRENDING NEWS

POPULAR NEWS

Write A Program To Print All The Leap Years Between Ad1 And Ad2010 And Also Print The Number Of

Write a program to print all the leap years between AD1 and AD2010, and also print the number of leap years.?

import java.util.*;
public class LeafYear
{
public static void main(String[] args)
{
int count =0;
for(int year=1;year<=2010;year++ )
{
if (year%4==0 ||(year%100!=0 && year%400==0))
{
System.out.println(year);
count++;
}
}
System.out.println("Number of leaf years ="+count);
}
}

Write a program to print all the leap years between AD1 and AD2010, and also print the number of leap years.?

import java.util.*;
public class LeafYear
{
public static void main(String[] args)
{
int count =0;
for(int year=1;year<=2010;year++ )
{
if (year%4==0 ||(year%100!=0 && year%400==0))
{
System.out.println(year);
count++;
}
}
System.out.println("Number of leaf years ="+count);
}
}

Write a program that prints the even numbers from 1 to 100?

Shalom, this should be an straightforward software to position in writing, in any language. What section are you having problems with? it really is your software, in effortless. It calls for one FOR LOOP and one IF statement: FOR x = a million TO one hundred .....IF x MOD 3 = 0 AND x MOD 5 = 0 THEN ..........PRINT "FitBit, "; .....ELSEIF x MOD 3 = 0 THEN ..........PRINT "in good structure, "; .....ELSEIF x MOD 5 = 0 THEN ..........PRINT "Bit, "; .....ELSE ..........PRINT TRIM$(STR$(x));", "; .....end IF next x forget with regard to the various classes. There are only there to indent the strains and make the code extra readable, when you consider that stupid Yahoo immediately left justifies each thing. I further, the commas to the print statement to make the perfect output a touch extra readable. software Output: a million, 2, in good structure, 4, Bit, in good structure, 7, 8, in good structure, Bit, 11, in good structure, 13, 14, FitBit, 16, 17, in good structure, 19, Bit, in good structure, 22, 23, in good structure, Bit, 26, in good structure, 28, 29, FitBit, 31, 32, in good structure, 34, Bit, in good structure, 37, 38, in good structure, Bit, 40-one, in good structure, 40 3, 40 4, FitBit, 40 six, 40 seven, in good structure, 40 9, Bit, in good structure, fifty 2, fifty 3, in good structure, Bit, 56, in good structure, fifty 8, fifty 9, FitBit, sixty one, sixty 2, in good structure, sixty 4, Bit, in good structure, sixty seven, sixty 8, in good structure, Bit, seventy one, in good structure, seventy 3, seventy 4, FitBit, seventy six, seventy seven, in good structure, seventy 9, Bit, in good structure, eighty 2, eighty 3, in good structure, Bit, 86, in good structure, 88, 89, FitBit, ninety one, ninety 2, in good structure, ninety 4, Bit, in good structure, ninety seven, ninety 8, in good structure, Bit,

Write a C++ program to find prime numbers between 1 to 100.?

The problem is of course simple , because finding all the prime numbers in a certain range of course expect 2 for loops!
one ( the outer for loop) selects the value under discussion , and the inner for loop determines its actually a prime number or not!
Here i present you a simple my simple code to find all prime numbers in a given range!

#include

void main()
{
int n , isprime;
cout<<"Enter range :";
cin>>n;
for( int i = 2 ; i <= n ; i++)
{
isprime = 1;
for( int j = 2 ; j <= i ; j++)
{
if( i == j)
continue;
else if( i % j == 0)
isprime = 0;
}
if(isprime)
cout< }
}

Thanks and regards !
Javєδ™

Write a C++ program that finds and prints out all of the prime numbers between 3 and 100.?

#include
using namespace std;
int main ()
{
int number=3, count=2;

while (number <= 100)
{
if ((number % count) > 0)
{
cout << number << " ";
number++;
count = 2;
}
else
{
count++;
}
}
cout << endl;

return 0;
}

This is what I have so far but I do not how to correct it to make it work properly.

TRENDING NEWS