C++ Program to Check for Prime or Composite Number with User Input ( Explained in Detail )
ฝัง
- เผยแพร่เมื่อ 30 ก.ย. 2024
- In this video you will learn to write a C++ Program to Check whether the Number Entered by the User is Prime or Composite Number.
A Prime Number is a natural number greater than 1 which is completely divisible only by 1 and itself. if a natural number is not a prime number then it is called as a Composite Number.
1 is neither prime nor composite
Get the source code of this tutorial at our website
www.LearningLad...
Catch us on Social Media
facebook / learninglad
twitter / learningladedu
Google+ www.google.com/...
#CppProgramming #LearningLad #PrimeOrComposite
Best explanation ever :)
Thank you 😊
How to make a flowchart of this?
Thank you so much
Pleasure
Thank u for this
We need more tutorials for c++
sure :)
why the code showing 9 is prime?
You are an absolute legend
Please make a series of videos on data structure using c++
i will plan one :)
@@LearningLad we'll be waiting
Hello .. Can anyone tell me why this code( without bool ) is not working ...
int main() {
int num;
int divisor;
coutnum;
if(num < 1){
cout
I think you can't use break twice.
Thank you bhai 🙏
Most welcome
You make this easy problem in the complex way
Sounds like you own a rooster. lol.
using namespace std ;
#include
int main ()
{
float number, i, flag=0;
cout number ;
if (number
Tell me my mistake
@@sourabhkumar8603 I believe it is the bracketing system on the IFs and ELSE IFs
if we enter '2' in input then number variable will be 2 and for loop won't work. This is a bug.
the for loop will not execute because the loop condition fails in the beginning.
this is not a bug.
program produces proper result
Super clear explanation...
Glad you liked it
what if user enters decimal point value ? what would be the code for not allowing float or double ?
Had to write it... Finally: FIIRRRSSSSSTTTTTT!!!
Nice tutoruals, btw!
Lun
Line 15 the condition should be
divisor
that the other way to do that problem ..
Its your choice what method you prefer