Cari Blog Ini

Minggu, 03 April 2011

Algorithm program to print a number that is divisible by 3 and 5 between 1 to 100

Algorithm program to print a number that is divisible by 3 and 5 between 1 to 100

1. program will display the statement "a simple program displays a number between 1-100 is divisible by 3 and 5" to the user.
2. after the program returns to call the function process.
3. function check process will be repeated from 100-100 numbers are depleted in the 3 and 5. If the 1-100 number is divisible by 3 and 5 the remainder is o, then the program will display the number and save it as a number. If not the program will ignore these numbers. Repeated until the number 100 in checks. And reverse the total value to the main function as the number of numbers which can be divided into 3 and 5.
4. function reverses the process of value to the function main.
5. program displays the output to the user.

HIS PROGRAM:

#include
#include
class bil{
public:
int proses();
private:
int total;
};
int bil::proses()
{
total=0;
for(int i=1;i<100;i++){ if(i%3==0 && i%5==0) { cout<

Tidak ada komentar:

Posting Komentar