Drawing flowcharts is impossible in a text-based forum. So here's the pseudocode instead:
Note that line 3 divides x by y and if the remainder is 0 then x is divisible by y, otherwise it is not.
flow chart of two numbers
#include using std::cout;using std::cin;using std::endl;int main(){double firstNumber = 0;cout > firstNumber;double secondNumber =0;cout
To check for divisibility, use the modulus, or % operator. If the expression results in zero, then the first number is divisible by the second number. For example, 10%5 equals 0 because 10 is divisible by 5. When the expression does not result in 0, the number is not divisible(10%7=3, so 10 is not divisible by 7).
Loop through some numbers - for example, 2 through 100 - and check each one whether it is a prime number (write a second loop to test whether it is divisible by any number between 2 and the number minus 1). If, in this second loop, you find a factor that is greater than 1 and less than the number, it is not a prime, and you can print it out.
/*PROGRAM TO ACCEPT TWO NUMBERS FROM THE USER AND PRINT THEIR MULTIPLICATION. */ #include<stdio.h> #include<conio.h> void main() { int a, b, c; // Declaration of Variables. Variables 'a' & 'b' to hold first & second number. And 'c' to hold result. clrscr(); // To clear the output screen every time program is executed. printf("\n Enter the first number : "); scanf("%d", &a); // To accept the first number. printf("\n Enter the second number : "); scanf("%d", &b); // To accept the second number. c = a*b; // Logic to get the product of the entered two numbers. printf("\n Multiplication of %d & %d = %d", a, b, c); // Displaying result. getch(); // To hold the output screen. }
#include<stdio.h> #include<conio.h> #include<string.h> int main (void) { char arry[100]; int i,count=0; float a,b; printf("Enter a 2 Number "); scanf("%d %d",&a,&b); if(a%b == 0){printf("its divisible");} else {printf("its not divisible"); } getch(); return 1; }
Convert this in flow chart and see if it can help Start Display "Enter 2 numbers" Accept 2 numbers A & B Divide the A with B Is result Zero? ---- No - A is not Dividable with second Yes - A is Dividable with second End
The concept of divisible and non-divisible makes sense only in the context of whole numbers. Once you allow fractions (or their decimal representations), every number is divisible by any non-zero number.
All numbers are not divisible by 3. In order to test if a number is a prime, you first test to see if it ends in a 2, 4, 6, 8, or 0. In that case it is divisible by 2 and not a prime. The next number you use for your test is 3. More odd numbers are divisible by 3 than by any other odd number but it is only the second number used for the test. You continue testing until you reach the square root of the number. If the number is only divisible by itself and one, it is prime. 3 is only the second test number in the division test for primes.
divisible
#include using std::cout;using std::cin;using std::endl;int main(){double firstNumber = 0;cout > firstNumber;double secondNumber =0;cout
The second.
Starting with 4, every fourth number from 4 to 100 is divisible by 4. The numbers are: 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100. 25 numbers between 1 and 100 are divisible by 4.
If the second number is divisible by 6 then neither first nor second number is odd.
The second.
Accept is stressed on the second syllable.
Sometimes.
'Accept' is neither a 'first' nor a 'second' syllable word. It is a two syllable word.