Well I have created this one and on my computer it is working. I would like to hear about some alternative solutions. INTRODUCTION This time I have one algorithm, but to understand it we need to consider a few terms. First of all, we should be familiar with the pangrams. For example: “The quick brown fox jumps over lazy dog” is the famous one. The pangram has all letters of a particular alphabet. Yes, there are perfect pangrams they have all the letters, but they don’t repeat more than once. In this case we will use: “D. V. Pike flung … |
+0 forum
7 | ||

Hey everyone, I am having trouble on this one practice problem. It is a question that requires another question I already completed to solve this one. The qusetion is "Implement a method allPerfect() that takes an integer parameter end. The method prints every perfect number from 1 to end. Use the method isPerfect() above to check if a number is perfect. " I am confused on how to use isPerfect to check if the number is perfect or not. Any help would be greatly appreciated. This is my isPerfect code: import java.util.*; public class isPerfect { public boolean isPerfect(int num) … |
+0 forum
10 | ||

Hello, I'm trying to write a program using MIPS Assembly Language (I write the code in TextWrangler and run it in QTSpim) I was wondering how I would go about checking if a number is perfect or not. I know my first lines of code may be partially incorrect but when I figure out the loop or how to check if a number is perfect it will all be easier to solve. Does anyone have any suggestions? My code so far is below and I put a note where I would put the check to see if a number is … |
+0 forum
0 | ||

I want to be able to write a program that repeatedly prompts the user to enter an integer. The program determines if that numbers is perfect and then writes out a message saying if it is or not, then prompts once again. I'll end the loop (and the entire program for that matter) when the user enters an integer which is less than one. I'll try to use mnemonic names for registers (like $s0, $t3) and any extended assembly instructions but will ignore branch delays and load delays. Does anyone have any suggestions on how exactly I would go about … |
+0 forum
4 | ||

A number is called a proper divisor of N if M < N and M divides N. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisors of 28 are 1, 2, 4, 7, and 14 and 1+2+4+7+14=28. Therefore, 28 is perfect. Write a program to display the first 4 perfect integers. I got this but the loop won't stop running. [CODE] public class PerfectNumbers { static int FIRSTPERFECT; static int SECONDPERFECT; static int THIRDPERFECT; static int FOURTHPERFECT; public static void main(String[] args) { findPerfect(); System.out.println(FIRSTPERFECT); System.out.println(SECONDPERFECT); System.out.println(THIRDPERFECT); … |
+0 forum
1 | ||

[CODE]#include<stdio.h> int main() { int n,i,c=0; printf("\nEnter a no:"); scanf("%d",&n); for(i=1;i<n;i++) { if(n%i==0) { c=c+i; } } if(n==c) printf("\nPerfect no."); else printf("\nNot a perfect no."); }[/CODE] |
+0 forum
5 | ||

For this code i am inputing one number and trying to see if it is a perfect number [CODE]#include<iostream> #include<cmath> #include<iomanip> #include<conio.h> using namespace std; void perfect(int); int isfactor(int, int); int N, i; int main() { perfect(N); isfactor(N, i); } int isfactor(int number, int divisor) { if(number%divisor==0) return 1; else return 0; } void perfect(int N) { int sum=0; cout<<"Enter an integer to see whether it is a perfect number or not: "<<endl; cin>>N; if(N>0) { for(i=1; i<=N; i++); { if(isfactor(N, i)) { sum+=i; } } if(sum==N) cout<<N<<" is a perfect number."<<endl; else cout<<N<<" is not perfect number."<<endl; } getch(); … |
+0 forum
9 |

The End.