C Program To Find Prime Numbers From 1 To 300 using For Loop

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024
  • technotip.com/7...
    Lets write a C program to print all the prime numbers from 1 to 300. (Hint: Use nested loops, break and continue).
    Prime Number: is a natural number greater than 1, which has no positive divisors other than 1 and itself.
    Note: Number 1 is neither prime nor composite number.
    C Programming Interview / Viva Q&A List
    technotip.com/6...
    C Programming: Beginner To Advance To Expert
    technotip.com/6...

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

  • @GauravSharma-kd7wc
    @GauravSharma-kd7wc 4 ปีที่แล้ว +7

    can you provide algorithm and flowchart of this ques

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

    U should try to explain better

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

    Your result is showing 1 as a prime number.. How??

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

    1 is not a prime number bro

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

    The vedio in your channel is very nice and beautiful

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

    wait, 1 isnt a prime number

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

    sir why the prime = 0 is there in second loop and prime =1 in first for loop please explain

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

      I'm initializing prime to 1 before second for loop starts. After the second for loop execution completes I check if prime is still 1. If so, then the number is PRIME orelse it's NOT PRIME.

  • @nakulgodara7961
    @nakulgodara7961 9 หลายเดือนก่อน

    an other way to write the programme for same output.
    #include
    #include
    #include
    int main(){
    int inputval, x ,y ,z;
    printf("enter a digit");
    scanf("%d",&inputval);

    for (x=2; x0; y--){
    z=x%y;
    if (z==0 && y>1){
    break;
    }
    else if (z==0 && y==1)
    printf("%d
    ",x);
    }
    }
    return 0;
    }

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

    Thank you very much. 👍👍🔝🔝

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

    Thanks

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

    Superb explanation bro..

  • @muvvalaprasanthkumar1764
    @muvvalaprasanthkumar1764 ปีที่แล้ว

    U r explains are good but , I want much more clarity.

  • @theartificial640
    @theartificial640 9 หลายเดือนก่อน

    Bhai please ek bar me sanjaya ka

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

    here why is num/2 in inner for loop, what is the purpose of it

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

    I=2 kyu liya 2 nd for loop me

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

    after breaking if(prime=0) how the prime= 1 works can u explain this please

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

      You can find the complete source code and explanation on our website. Kindly visit the link present in the description section of above video. Thank you 🙏

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

      It basically means that when prime=0 then the complier would understand that it is not a prime numbers and when prime is prime which means prime=1 we specify the compiler that the number is prime

    • @gp-manan6896
      @gp-manan6896 11 หลายเดือนก่อน

      ok thanks
      @@Sake679

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

    Thank u so much sir

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

    How to find largest 9 digit prime number in c program