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

ความคิดเห็น • 32

  • @sailendrachettri8521
    @sailendrachettri8521 2 ปีที่แล้ว +4

    Best explanation ever :)

  • @yellowhite3
    @yellowhite3 6 หลายเดือนก่อน

    How to make a flowchart of this?

  • @w.t.c.7788
    @w.t.c.7788 3 ปีที่แล้ว +2

    Thank you so much

  • @sohailahmed8144
    @sohailahmed8144 4 ปีที่แล้ว +5

    Thank u for this
    We need more tutorials for c++

    • @LearningLad
      @LearningLad  4 ปีที่แล้ว

      sure :)

    • @rajadas9716
      @rajadas9716 2 ปีที่แล้ว

      why the code showing 9 is prime?

  • @smsofficial4809
    @smsofficial4809 11 หลายเดือนก่อน

    You are an absolute legend

  • @zeeshanahmad8452
    @zeeshanahmad8452 4 ปีที่แล้ว +4

    Please make a series of videos on data structure using c++

  • @ochokochi4594
    @ochokochi4594 2 ปีที่แล้ว

    Hello .. Can anyone tell me why this code( without bool ) is not working ...
    int main() {
    int num;
    int divisor;
    coutnum;
    if(num < 1){
    cout

    • @phyopaing8239
      @phyopaing8239 2 ปีที่แล้ว

      I think you can't use break twice.

  • @virajgawand7133
    @virajgawand7133 2 ปีที่แล้ว +1

    Thank you bhai 🙏

  • @aryamansingha9984
    @aryamansingha9984 2 ปีที่แล้ว

    You make this easy problem in the complex way

  • @StaticBlaster
    @StaticBlaster 2 ปีที่แล้ว

    Sounds like you own a rooster. lol.

  • @sourabhkumar8603
    @sourabhkumar8603 3 ปีที่แล้ว +2

    using namespace std ;
    #include
    int main ()
    {
    float number, i, flag=0;
    cout number ;
    if (number

    • @sourabhkumar8603
      @sourabhkumar8603 3 ปีที่แล้ว +1

      Tell me my mistake

    • @GoldPoptart
      @GoldPoptart 2 ปีที่แล้ว

      @@sourabhkumar8603 I believe it is the bracketing system on the IFs and ELSE IFs

  • @onurolce
    @onurolce 3 ปีที่แล้ว +2

    if we enter '2' in input then number variable will be 2 and for loop won't work. This is a bug.

    • @LearningLad
      @LearningLad  3 ปีที่แล้ว +3

      the for loop will not execute because the loop condition fails in the beginning.
      this is not a bug.
      program produces proper result

  • @poojaj2905
    @poojaj2905 4 ปีที่แล้ว +3

    Super clear explanation...

  • @9841554468
    @9841554468 2 ปีที่แล้ว +1

    what if user enters decimal point value ? what would be the code for not allowing float or double ?

  • @carosworldofficial
    @carosworldofficial 4 ปีที่แล้ว

    Had to write it... Finally: FIIRRRSSSSSTTTTTT!!!
    Nice tutoruals, btw!

  • @arslanayaz1915
    @arslanayaz1915 3 ปีที่แล้ว

    Lun

  • @AliAlRabeeiaaa41
    @AliAlRabeeiaaa41 4 ปีที่แล้ว

    Line 15 the condition should be
    divisor

    • @R7amos
      @R7amos 3 ปีที่แล้ว +2

      that the other way to do that problem ..
      Its your choice what method you prefer