C++ FUNCTIONS (2025) - Functions return statement, How to check prime number PROGRAMMING TUTORIAL

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 พ.ย. 2024

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

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

    📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
    C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
    Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
    🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
    Experience the power of practical learning, gain career-ready skills, and start building real applications!
    This is a step-by-step course designed to take you from beginner to expert in no time!
    💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
    Use it quickly, because it will be available for a limited time.

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

      You are really a great teacher. I wish if you used simple code here though, to teach us about function return.

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

      numofpn++;
      This is what I added to count how many prime numbers there are from 1 to 1000. I added it in the for loop on MAIN. Just sharing. Thanks for your videos.

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

    Your explanations are so, so clear and understandable. Glad I found you!

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

      I'm happy that you found me 😉🤗

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

    Way better than my teachers. You doing a great job.

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

    You could optimise the code even further by only checking against previously found primes.
    For example. When you want to establish whether 11 is a prime you only need to test this by dividing by 2, 3 and 5 since those are prime numbers. Anything that will divide by 4 will also divide by 2 since 4 isn't a prime number (anything over 5 can't be it because that would result in a number smaller than 2 as Marko Shiva Pavlovic said before). I think this will be easiest by using a list (or a C++ equivalent) and iterating through the list. If you find a prime you add it to the list.
    For small numbers the time saved is minimal (for 11 you only skip the 4) but for larger primes the time saved can add up rather quickly. As a human this would be more difficult since you need to remember (or write down) the previous primes but computers are very good at this.
    Love your videos by the way. I did not know any C++ a couple of days ago and I have the hang of the basics now (I inherited a lot of C++ code that I either need to understand or rewrite from scratch in a language I know).

  • @btgomathie3706
    @btgomathie3706 3 หลายเดือนก่อน

    I know only tamil...and I searched a good youtube channel for learning c++ ..that time only i found your channel..and you is so good andyour communication is too understandable to learn easily and quickly..keep teach for us mam

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

    Also we can write main function without any declaration of bool variable, the function isPrimeNumber can be written directly to if condition.
    void main()
    {
    for (int i = 1; i < 1000; i++) {
    if (isPrimeNumber(i))
    cout

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

    Big Thanks for sharing this video :) Good stuff for beginners like me . I (personally) took notice that my knowledge of bool functions weren't that deep.
    I adjusted (for my personal study and coding experience) the functions. I created a code which 1) shows all numbers that can be divided by 24 after telling it to the programme and 2) your "homework" which counts how many full days (in my case) there are.
    // --> 24h indication and full Day(s) converter hours;
    for (int i = 3; i

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

    YOU ARE A GREAT TEACHER

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

    I'm A Big fan to your voice and the way you teach us.
    Love Form Bangladesh

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

    Very good video! I did a similar implementation for a prime checker in C a couple of months back and now that I am beginig to experiment with C++ im going to try this!
    Just a note to add: you dont need to check for a divisor by checking all the numbers less than the input number, you just need to check up to the ceil of the square root of the number.

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

    Pozdrav od Makedonija
    You are explain very , very good ...

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

    i consider myself very happy because i have found such an amazing teacher😍

  • @asgardia-1977
    @asgardia-1977 3 ปีที่แล้ว

    You are the best teacher I've seen so far. And best is an understatment. Thank you for all you do for the community Saldina

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

    You're such a great teacher, Saldina!

  • @NoumanKhan-w4x
    @NoumanKhan-w4x ปีที่แล้ว

    declare and initialise count variable = 0 and use it in loop below is prime If statement
    that will count every prime number and will increase by one each time a primer number is detected .
    Thank you for such good tutorial

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

    Excellent 👍. All your tutoring so far has been really EXCELLENT 👍 for me, many thanks and please continue ☺️

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

    Hi, I'm from Russia. I'm watching you on January 1 at 20:24. All the best to you.

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

    Nice video. Thank you!
    Very clear explanation.
    I used C++ in the 90s.
    Is such a joy watch this after so many years.
    You have a great content and I came to your channel through Brads.

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

      I was born in 95. I'm glad to see that experienced people are visiting my channel as well! ☺️
      Brad is unique. I've learned so many things on his channel, so it was a great honor to be presented as an educator on Traversy Media! 🥰

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

    it was so fantastic your explanation is so best than others keep it up

  • @VivekSharma-ux2bl
    @VivekSharma-ux2bl 3 ปีที่แล้ว +1

    Really enjoyed functions and pointers playlist....and now i am confident about these topics....please consider making more videos more frequently about OOP concepts

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

    I love this video and all of the modifications presented in the comments. One person presented a counter which indicates there are 9592 prime numbers between 1 and 100,000. It would be really helpful if those 9592 prime numbers could be exported to an external CSV file. Printing them on the screen is of limited utility.

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

      2 years late (haha), but here's a modified version of her code that outputs data to a csv file named "Output", as well as puts it onto the screen for immediate viewing. All I really had to do was output it to a file instead of the console, which isn't hard (though I did end up doing both). I also added a simple prime counter, which does indeed count 9592 prime numbers (1 is excluded because it's technically not prime for reasons).
      #include
      #include
      using namespace std;
      bool isPrimeNumber(int number) {
      for (int i = 2; i < number; i++) {
      if (number % i == 0)
      return false;
      }
      return true;
      }
      void main()
      {
      int number;
      int noOfPrimes = 0;
      cout > number;
      ofstream outData("Output.csv");
      for (int i = 2; i < number; i++) {
      bool isPrime = isPrimeNumber(i);
      if (isPrime) {
      noOfPrimes++;
      cout

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

    Interesante. Me gustan tus videos, aunque la traducción automática no es tan buena, pero te voy entendiendo. Gracias por tu dedicación.

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

    Great video
    int main()
    {
    int c = 0;
    6 for(int i = 1; i

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

    Thanks my sister I am more enjoy your Explanation and I am more understand c++ function

  • @ei5bo
    @ei5bo 9 หลายเดือนก่อน +2

    #include
    using namespace std;
    bool isprimenumber(int value){
    bool isprim=true;
    for (int i=2;i

    • @rawandalkalame6959
      @rawandalkalame6959 19 วันที่ผ่านมา

      Thank you so much, I completely missed the idea of using counters for this process.

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

    hi Saldina, I am a seasoned programmer in other languages and always avoided C++....I dislike it ! I can't stand the squiggly brackets paradigm and the semi-colon requirements !! that said, the biggest issue for me has always been the teacher !! why....cause 1-clarity during explanations, 2- going off on tangents, 3-pace of explanations, and visuals of what your are explaining vs whats on screen !!! In all the "courses" I have tried to follow, I have to admit that you are the only one that has kept me listening and that's not easy to do! congrats !!! Enjoy the coffee and don't drink them all on the same day !! :) ...... one question - Why is there no semi-colon after i++ in your loop?

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

    If you prototyped the functions I would reference your videos in my college classes. Consider using VS Code instead of Visual Studio since most students don't have access to it and the pause will confuse begginers. I know you have videos on the issue.

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

    Thank you Saldina your explanation is so understandable but there is a little mistake in checking prime numbers, the program displays 1 as a prime number and 0 too and we can solve this problem by adding if statement

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

    Hello !! One question: how can I keep track about the functions I or an other person did create ? - are there any "library" structures ?
    Thank you !!! for your excelent and outstanding work in your tutorials. It is a real pleisure to go through them - it makes programming a real fun time (-:

  • @MaissaBriber-w4o
    @MaissaBriber-w4o 7 วันที่ผ่านมา

    your explination i s just so perrrfeecttt

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

    Appreciate your videos. I have a question. Can we save the function and main program as two separate files and run the main program. If yes can you make a video on this

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

    Thanks for such a great explanation.

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

    You are Awesome Mam,I love to watch your videos...These are very helpful...

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

    you are such an amazing programmer glad i found you but can you help me with something?
    i am a student at the faculty of computer science and i want to study data science so can you make a video to explain what i am supposed to study to work in data science career

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

    Very great explanation ..thank for the video

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

    Thanks a billion.
    I just need to know the difference between definition and declaration in coding

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

    Great video, you made the concept clear to understand, but 1 is not prime

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

    good job keep up doing the good teaching Iam very greatful to you thanks alot

  • @user-Ali-Al-Mosleh
    @user-Ali-Al-Mosleh ปีที่แล้ว

    the number of prime numbers between
    1 and 100 is : 25
    1 and 1000 is : 168
    1 and 10000 is : 1229
    1 and 100000 is : 9592

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

    you just add a counter variable and set it equal to 0 then increment it by setting counter = counter++ but outside of the for loop . I had to try it a few times but it worked.

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

    you help me a lot, thank you!!!

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

    #include
    #include
    #include
    using namespace std;
    bool isPrimeNumber(int number){
    for (int i = 2; i < number; i++)
    {
    if(number % i == 0)
    return false;
    }
    return true;
    }
    int main()
    {
    int counter = 0;
    for (int i = 1; i

  • @YazeedSeraj
    @YazeedSeraj 4 หลายเดือนก่อน

    15:06 Refactoring means improving the internal structure and readability of a function without changing its external behavior or functionality

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

    *spoilers* I wanted to challenge myself by changing the program. I decided to change bool to int so that I could return the factor if it wasn't prime. Then after modifying to check all numbers 1-1000 I was bored with all the 2's. So I decided to have it go in reverse by starting with number/2 and counting backwards from there so that the final result showed the largest factor for each number if they weren't prime. I'm fairly proud of myself, took some playing around to figure out what I was doing wrong. I'm aware this is less efficient but I was just playing around. here is the code.
    I also added a count so it listed the total number of primes.
    #include
    using namespace std;
    int isPrime(int number) {
    for (int factor = number/2; factor > 1; factor--) {
    if (number % factor == 0)
    return (factor);
    }
    return 0;
    }
    int main() {
    int total = 0();
    for (int number = 2; number < 1000; number++) {
    int isprime = isPrime(number);
    if (isprime == 0)
    cout

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

    Try to use (number/2) instead of number in for loop.

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

      Can you paste the code? 🤔

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

      @@CodeBeauty for(int i =2;i

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

      Well, that is a nice optimization! 😍
      Same result with half the iterations! 🤓

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

      @@CodeBeauty mathematics 😁

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

      If you use (number/2) the program will return 4 as prime number which is not right...

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

    Thank you m'am.
    Great job

  • @al-meezanacademy4722
    @al-meezanacademy4722 3 ปีที่แล้ว

    As usually looking gorgeous ❤️
    And video was usefull and simple

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

    @codebeauty Watching your videos is fun. I especially like the way you build up your videos with the knowledge learned in the previous once and all the examples you use.

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

    Thanks Saldina,
    I really like your videos.
    Maybe you can make a video on how to calculate all prime numbers from x to y with Threads ?
    It should be much faster to split the numbers and have multiple threads calculate the results ? But I also wonder how to give every thread the equal amout of work then ?
    Maybe you can make a video on this ?
    Thanks,

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

    hey there im very happy with your videos thank you ....but i want to ask you about passing condition fir the loop saying int i = 1 so all the numbers between 1 to 1000 will be prime number This is not correct according to the definition of prime numbers, which should only be divisible by 1 and themselves.

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

    a beauty from a beauty

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

    Thanks for the video. Very clear and understandable. However since 1(one) is not considered a prime number, how can 1(one) be omitted from the output? Thanks.

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

      Hi, you either set the initial value of i to 2 or extend the condition for evaluation of i as follows:
      if (i!=1 && isPrime) {
      cout

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

    i love you teacher

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

    what is default return type in function in c++ ?? As in c default type is int, so i guess it should be in c++ aswell since you told in one of your video that everything in c is correct in c++ also.

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

    can we use other thing rather than bool

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

    Nice explanation

  • @sevatar4846
    @sevatar4846 6 หลายเดือนก่อน +1

    Perfect but 1 is not a prime number. 22:04

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

    Dont mind but returning a single value from a function is super easy, its very easy even a 2 year old kid can do this .Can you tell me how to code a program in which when you pass an array of random numbers to a functions and return an array of prime numbers from that function and print that array with out printing garbage values.

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

    If you declare a function above the main and u have the function below the main ()and pass parameters... do you also need to put those parameters in the declaration?

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

      Nevermind, you answered my question in the next video😅

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

    Here is my upgraded code:
    int main()
    {
    int k = 0;
    for( int i=2; i

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

      Great! 😊 You're progressing very fast! 😯
      I'm currently preparing C++ crash course that covers a lot of concepts, so I'll definitely let you know when that is published. It is not meant for beginners, but I think that you will be able to understand and learn a lot of things.

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

    just made a small change to the "for" loop to find out how many prime nr are between 1 and 1000: (added a count=0)
    int count = 0;
    //check all prime nr between 1 and 1000
    for (int i = 1; i

  • @trlavalley9909
    @trlavalley9909 7 หลายเดือนก่อน

    int main() {
    int Hits=0;
    for (int i=1; i

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

    So you also no need to create a new variable in line 15 : bool isPrime. You can use without it like 'if (isPrimeNumber(i)) cout

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

    You don't have to check "every number

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

    I just love you!

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

    Hello Saldina! Congratulations for all your work. I watched all your 19 videos from C++ for beginner and I found them very interesting.
    I was trying to solve the problem of number 1 by inserting at the end of the isPrimeNumber function, this condition:
    (number == 1)? return false : return true; ....but it does't works. Ididn't understand why.
    This one insted, works: if(number == 1) return false;
    else return true;

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

      The ternary operator "?" can only return a value, it can't carry out commands. So C++ doesn't like the 'return' in the condition.
      You can achieve what you're trying to do by rearranging your condition like this: return (number == 1) ? false : true;

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

      @@QuietlyWrong thank you

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

    Thanks

  • @KuwanRandyLanjo-nf9ex
    @KuwanRandyLanjo-nf9ex 8 หลายเดือนก่อน

    This one is quite tough

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

    What do you use if you need multiple return values?

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

      we can not do this in C or C++ directly but we can return the address of the array that has these values. Also this array should be dynamic array that is allocated by heap section of the memory

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

    why we are not using {} sign for code below ?
    if(isPrimeFlag)
    cout

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

    Number of prime numbers between 1 and 100000
    int count = 0;
    for (int i = 1; i

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

    No others explanation will match with urs

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

    hallo Codebeauty,
    Great video. My quetion is how does it implement the prime number of 2? at line 5 in the for loop for(int i = 2; i < number; i++)
    if i take 2 as the number and i as my counter value , then (2

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

      Yea. You are almost right. not the body of the function but the body of the for will not execute due to i < number condition. So it returns true to the main function. We did like that because we dont need chech whether 2 is a prime number or not. I hope you understand what i mean. If you have any question, I can explain more deeply

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

    I don't know I'm struggling a bit but trying my best to understand. Also added how many prime nb their is........
    #include
    using namespace std;
    bool isPrimeNumber(int number) {
    bool isPrime = true;
    for (int c = 2; c < number; c++)
    {
    if (number % c == 0)
    return false;
    }
    return true;
    }
    void main()
    {
    int counter = 0;
    for (int i = 1; i < 1000; i++)
    {
    bool isPrime = isPrimeNumber(i);
    if (isPrime)
    {
    cout

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

    Total prime number count between 1 and the number user will enter:
    #include
    using namespace std;

    bool isPrime(int n);

    int main()
    {
    int num, count=0;
    coutnum;
    for(int j=1; j

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

    is it still safe to do it this way?
    if(isPrimeNumber(number)){
    cout

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

      Yes, indeed. That Boolean isPrime was unnecessary.

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

    i love u teacher

  • @m.s659
    @m.s659 3 ปีที่แล้ว +1

    There's a small bug, which is a prime number must be greater than 1.

  • @Awp-c4y
    @Awp-c4y 5 หลายเดือนก่อน

    the best

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

    am just finished 'c++ for beginners' now am here but am think this one is harder.
    int num;
    cin >> num;
    if (prime(num) == true ) {
    cout

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

    i did a program that interval is identified by user. Here it is:
    #include
    using namespace std;
    bool isprimenumber(int number = 1)
    {
    for (int i = 2; i < number; i++)
    {
    if (number % i == 0)
    return false;
    }
    return((number == 0) || (number == 1)) ? false : true;
    }
    void main() {
    int start, last;
    int counter = 0;
    cout > start;
    cout > last;
    for (int j = (start-1); j

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

    Hey Saldina
    I''m from Pakistan and i am studying computer science now i am in 3rd semester we are studying c++ and object oriented programing your videos give me much more help.
    i ust write a code for which the user input a number this will show all prime and non prime numbers btw the user enter and also show how many prime numbers and non prime numbers.
    #include
    using namespace std;
    //find all prime numbers and non prime numbers between which the user is entered
    //this is the algrithm for finding prime number and non prime numbers
    bool isPrimeNumber(int number)
    {
    bool isPrimeFlag = true;
    for(int i = 2 ; i < number ; i++)
    {
    if(number % i == 0)
    {
    isPrimeFlag = false;
    break;
    }
    }
    return isPrimeFlag;
    }
    int main()
    {
    int number;
    int primeNumbers = 0;
    int nonPrimeNumbers = 0;
    cout > number;
    for (int i = 0; i

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

    bool isPrimeFlag = (number >= 2);
    int max = (int) sqrt(number); // I used sqrt() function instead of counter*counter

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

    like that :)
    #include
    using namespace std;
    bool isprimenumber(int number)
    {
    bool isprime = true;
    for (int i = 2;i < number;i++)
    {
    if (number % i == 0)
    return false;
    }
    return true;

    }
    int main() {
    int counter = 0;
    for (int i = 2;i

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

    You are such a great teacher i understand much better here than my class room but i have a request can you please tie your hairs cuz it always grab attention towards you

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

    Sound please

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

    Thank u for this video, its amazing..
    Here the count, how many prime number in between 1 to n number
    #include
    using namespace std;
    {

    for(int i=2; i>n;
    int count=0;
    for(int i=1; i

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

    a program that counts the number of prime numbers b/w a given input
    #include
    using namespace std;
    bool isPrimeNumber(int number);
    int main() {

    int number1;
    int number2;
    cout > number1;
    cout > number2;
    int count=0;
    for (int i = number1; i < number2; i++) {
    bool isprimeflag=isPrimeNumber(i);
    if (isprimeflag) {
    cout

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

    Why are you called codebeauty? What does code have to do with beauty?

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

      Coz I'm beauty and I do code 😏😁

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

      @@CodeBeauty can’t argue with that.

    • @zy.r.4323
      @zy.r.4323 2 ปีที่แล้ว

      @@CodeBeauty You're absolutely right :D

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

    16:41 return 0

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

    #include
    using namespace std;
    bool Is_Prime_Number(int); // declaration/prototype
    int main() {
    int input_number,sum_ofPrime=0;
    cout > input_number;
    for (int the_prime=1; the_prime

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

    where is the code!!

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

    #include
    using namespace std;
    bool PrimeNumber(int number);
    int main()
    {
    int count=0;
    for(int i=2; i

  • @Mikhail-r1c
    @Mikhail-r1c 11 หลายเดือนก่อน

    namespace ConsoleApp9
    {
    internal class Program
    {
    static void Main(string[] args)
    {
    double a, b;
    Console.Write("enter number A: ");
    a = Convert.ToDouble(Console.ReadLine());
    Console.Write("enter number B: ");
    b = Convert.ToDouble(Console.ReadLine());
    double result = Sum(a, b);
    Console.WriteLine(result);
    Console.ReadLine();
    }
    static double Sum(double a, double b)
    {
    return a + b;
    }
    }
    }

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

    the sound in short videos where you dancing is very high and where peoples learning something useful is very slow what type of data is this

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

    18:00

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

    Why your audio so weak?

  • @ahmed.bhewary775
    @ahmed.bhewary775 3 ปีที่แล้ว

    Saldina I built your own code, it doesn't work as well, it gives errors, I will post the code here and waiting for comments
    #include
    using namespace std;
    bool isPrime(int Number)
    {
    for (int i = 2; i < Number; i++)
    {
    if (Number % i == 0)
    {
    return false;
    }
    else
    {
    return true;
    }
    }
    }
    int main()
    {
    int number;
    cin >> number;
    for (int i = 1; i

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

    I tried this way.......
    #include
    using namespace std;
    bool isPrimeNumber(int number) {
    for (int i = 2; i < number; i++) {
    if (number % i == 0) {
    return false;
    }
    }
    return true;
    }
    void main() {
    int range;
    int counter = 0;
    cout > range;
    for (int i = 1; i

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

    Hi, my version with user input of numbers he wants to check and a counter of how many prime numbers in the specified range:
    #include
    bool isPrimeNumber(int number);
    int num;
    int main() {
    std::cout > num;
    int count = 0;
    for (size_t i = 1; i

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

      Thanks for the example. I was having trouble understanding how to implement the count into the code.

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

      @@ronjackson8829 Thanks for the reply. Sorry for my bad english (i'm a 49 year old german). I have started out with learning to code this year with some HTML, CSS and Javascript and wanted to improve my skills with some C++, because i think it helps to learn any other language. And it does. Learning Javascript feels so much easier for me now, with some knowledge of C++ and from all the TH-cam Courses i have tried this year, this is the first where i understood everything.

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

      Bernd Baberske NP...I really like the instructor’s style here.

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

      Nice... Just one thing to add ..using square root of n instead n/2 will improve the performance of the program especially when u are dealing with numbers as large as 100,000