Sum of two number in c++ programming | c++ coding | programming in c++ language | cpp programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ส.ค. 2022
  • sum of two number in c++ programming language
    c++ coding,
    cpp coding

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

  • @savitajoshi6834
    @savitajoshi6834 2 หลายเดือนก่อน +11

    C :
    #include
    int main() {
    int x = 5;
    int y = 6;
    int sum = x + y;
    printf("%d, sum);
    return 0;
    }
    Output : 11

    • @drfutato
      @drfutato 20 วันที่ผ่านมา

      #include
      int main(void) {
      Int x, y, sum;
      printf(“Enter two numbers: );
      scanf(“%d%d”, &x, &y);
      sum = x+y;
      printf(sum);
      Or, forgo sum altogether and
      printf(x + y);
      return 0;
      }

  • @user-zn4uq6cd5f
    @user-zn4uq6cd5f 8 หลายเดือนก่อน +3

    Very help . For you thank you

  • @satvikkhare1844
    @satvikkhare1844 6 หลายเดือนก่อน +11

    How can I get 30s of my life back. Do it using pointers.

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

    Very helpful.. thank you so much 🙏

  • @NysShortCut
    @NysShortCut 7 หลายเดือนก่อน +49

    You should use
    export inline template requires (Ty1 obj1, Ty2 obj2) { obj1 + obj2; } auto get_sum(const Ty1& obj1, const Ty2& obj2)->decltype(obj1 + obj2)noexcept(noexcept(obj1 + obj2)){
    return obj1 + obj2;
    }

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

      Not really.

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

      Try hard

    • @wojtekdudek2374
      @wojtekdudek2374 7 หลายเดือนก่อน +1

      True

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

      or just use double datatype

    • @kinershah464
      @kinershah464 5 หลายเดือนก่อน +2

      Why? If he wants to add two integers, then he will add two integers, no need for templates. Don't complicate things.

  • @user-wl3bi6sv8k
    @user-wl3bi6sv8k 7 หลายเดือนก่อน +5

    Fun to code

  • @virno69420
    @virno69420 4 หลายเดือนก่อน +3

    Use correct initialization int a{}, etc.

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

    Y bhtt intrsting h yrr m to ab shuru krri hu seekhna i am b com krliya h ab complete but man h to bs seekhna h ye bhi i hope easy rho

    • @aniketroy3034
      @aniketroy3034 5 วันที่ผ่านมา

      all the best! it's always good to see a non-techy trying coding

  • @Neonili
    @Neonili 6 หลายเดือนก่อน +2

    I was always doing cout no. 1;
    And then repeat with no. 2 but i see that i can just do cin >> a >> b;

  • @maliksami133
    @maliksami133 8 หลายเดือนก่อน +3

    Very easy

  • @digitalmachine0101
    @digitalmachine0101 7 หลายเดือนก่อน +1

    Thanks

  • @kahumaisaac7699
    @kahumaisaac7699 9 หลายเดือนก่อน +6

    Me it has failed

  • @CripsyBanks
    @CripsyBanks 3 หลายเดือนก่อน +1

    This music is a W

  • @djlystics
    @djlystics 4 หลายเดือนก่อน +3

    What about if you want the user to be able to enter more numbers for the sum without knowing how many numbers he will enter? Asking because that’s my homework for this week. Trying to figure out how to write a program for multiple numbers where as it outputs sum of even numbers, sum for odd numbers, and total sum.

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

      Use the "for" loop.
      int n, x, s=0;
      cin >> n;
      for(int i=1; i> x; // this will be read n times
      s = s + x; // adds the current number to the sum
      }
      Let's say you have 4 numbers (3 7 9 18). i (from the for loop) will start out as 1, it will check if it's smaller then n (which in this case will be 4, cause we have 4 numbers) then it will execute what's inside the for loop. Then i will increase and so on.
      I'm guessing you know how to check if a number is odd or even using if statements.

  • @user-ql3hl2ne1t
    @user-ql3hl2ne1t 3 หลายเดือนก่อน +1

  • @Kirjahri2
    @Kirjahri2 17 วันที่ผ่านมา

    the horizontal and vertical whitespacing in this code is making me have a conniption

  • @Merovingien514
    @Merovingien514 8 หลายเดือนก่อน +7

    Lol, std::cout instead of using namespace std😅

    • @toby9999
      @toby9999 7 หลายเดือนก่อน +2

      It's not funny. Both are correct.

    • @Merovingien514
      @Merovingien514 7 หลายเดือนก่อน +3

      @@toby9999 For a beginner programmer, yes, but in real projects, using namespace std can consume memory.

    • @kinershah464
      @kinershah464 5 หลายเดือนก่อน +1

      ​@@Merovingien514consume memory? I don't think so.

    • @virno69420
      @virno69420 4 หลายเดือนก่อน +5

      ​@@Merovingien514It doesn't require memory? The reason it's considered bad practice is because you're likely to get naming collision between functions. That's why they made std namespace.

  • @joshnathanielarcilla6127
    @joshnathanielarcilla6127 9 หลายเดือนก่อน +21

    Sup fellow coder that uses android to code 👊😊😊

    • @kahumaisaac7699
      @kahumaisaac7699 9 หลายเดือนก่อน +1

      Bro wats up

    • @kahumaisaac7699
      @kahumaisaac7699 9 หลายเดือนก่อน +1

      I need some help

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

      ​@@kahumaisaac7699why bro? Do you have any troubles in your code?

    • @maneee4263
      @maneee4263 5 หลายเดือนก่อน

      what u need help with
      @@kahumaisaac7699

    • @dylanisaking
      @dylanisaking 5 หลายเดือนก่อน +5

      I would genuinely rather walk on burning coal than code on mobile, no offense

  • @MARKUS-mc5ez
    @MARKUS-mc5ez 8 หลายเดือนก่อน +10

    in cout, remove the quotes where a+b so the numbers that you entered instead of letters will be output

  • @Fvlyme
    @Fvlyme 2 หลายเดือนก่อน +1

    But you can make it with "switch" and "case" or also "if" and "else"

    • @___balls448
      @___balls448 2 หลายเดือนก่อน

      Isnt that Python?

  • @user-hd4hx3ev4k
    @user-hd4hx3ev4k 3 หลายเดือนก่อน +1

    Where is the enter button in the phone

  • @mahidahiya6008
    @mahidahiya6008 3 หลายเดือนก่อน +1

    c++ k program kha pr bnte h

  • @sheepuff5999
    @sheepuff5999 10 วันที่ผ่านมา

    I don’t think “using namespace std” is a healthy convention. In a larger codebase, you might accidentally overwrite one of the std functions if someone unknowingly writes a function with the same function name as a common std function

    • @user-pj9ng1ch3u
      @user-pj9ng1ch3u 6 วันที่ผ่านมา

      Cbhcvbllppghpogvkjgfgoihgoougi0

  • @Aryanshiva-he5ec
    @Aryanshiva-he5ec 7 หลายเดือนก่อน +9

    bro 1 error is generating

  • @MrTrader-om4cm
    @MrTrader-om4cm 7 วันที่ผ่านมา

    Konsi app hai bhai

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

    what about the random sum?

  • @user-oe5sr2ef5l
    @user-oe5sr2ef5l 12 วันที่ผ่านมา

    Что такое return и надо ли это убрать?

  • @polyskitchen2795
    @polyskitchen2795 23 วันที่ผ่านมา

    Taking a look at c++ and im already getting brainf###

  • @talhamahmood6531
    @talhamahmood6531 8 หลายเดือนก่อน

    twenny one

  • @AadityaBhowmick
    @AadityaBhowmick ปีที่แล้ว +31

    It would have been better if you wrote:
    cout

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

      Nyc kia programming hwy apki well-done

    • @user-zx5xx4qu1h
      @user-zx5xx4qu1h 8 หลายเดือนก่อน +2

      it would be better to write
      cout

    • @AadityaBhowmick
      @AadityaBhowmick 8 หลายเดือนก่อน

      @@RaoRawal786 kyun yaar isme galat kya hai? main abhi bhi sikh raha hun class 8 mein hu mein

    • @AadityaBhowmick
      @AadityaBhowmick 8 หลายเดือนก่อน

      @@user-zx5xx4qu1h yeah that can be done either

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

    Bro substraction

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

    can you make a video about x, and y

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

      Yes we can by using pointers 👌🏻

  • @user-lu7ns3ys1n
    @user-lu7ns3ys1n 6 หลายเดือนก่อน +3

    What name of the app

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

      C++ bruh 😎😂😂😂😅😅

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

    💀

  • @softwaredynamicsolutions
    @softwaredynamicsolutions 8 หลายเดือนก่อน

    👍

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

    jse c program turbo c or bnte h usi trha c++ kha bnte h

    • @fachoyt9686
      @fachoyt9686 2 หลายเดือนก่อน

      C++ code b Turbo per run ho jata hai but try Dev C++, it is much better than Turbo.

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

    What apps do u use?

  • @gowrishx-darivazhagan3749
    @gowrishx-darivazhagan3749 ปีที่แล้ว +1

    Hi

  • @youssefsh333
    @youssefsh333 24 วันที่ผ่านมา

    what program is this

  • @milandangi2005
    @milandangi2005 4 หลายเดือนก่อน +1

    How the battery Percentage increases while the program is runned 😂

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

    11

  • @_____2525
    @_____2525 7 หลายเดือนก่อน +1

    very hard algorithm

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

      its the easiest one

  • @surendar4903
    @surendar4903 9 หลายเดือนก่อน +1

    Bro in which app?

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

      C++

    • @6ixty-Four
      @6ixty-Four 8 หลายเดือนก่อน

      ​@@savitabhople2774app?not

    • @user-is9rk1ol7g
      @user-is9rk1ol7g 4 หลายเดือนก่อน

      What are u doing here😂😂

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

      No but which version

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

      I want to install but I can't this exact same

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

    Ye kon sa app h bhai ?

  • @Mooproxy
    @Mooproxy 7 หลายเดือนก่อน +1

    Using namespace std, declaring all your variables at the top of a scope block, and using a comma to declare multiple things on one line are all horrible practices in C++.

    • @toby9999
      @toby9999 7 หลายเดือนก่อน +1

      Says who? You?

    • @kacperek3594
      @kacperek3594 7 หลายเดือนก่อน +1

      Why? xD

    • @kinershah464
      @kinershah464 5 หลายเดือนก่อน +1

      Using namespace std is fine for such simple programs. Multiple declarations separated by comma is also fine, it's valid syntax.

  • @user-fx3tu1nw7v
    @user-fx3tu1nw7v 3 หลายเดือนก่อน

    Wrong this code 😢

  • @rovinyadav4191
    @rovinyadav4191 7 หลายเดือนก่อน +1

    Error

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

    In C this program looks like this:
    #include
    int main()
    {
    int a, b, sum;
    printf("Enter two numbers: ");
    scanf("%d%d", &a, &b);
    sum = a + b;
    printf("a + b = %d", sum);
    return 0;
    }

  • @Omimanono19
    @Omimanono19 7 หลายเดือนก่อน +1

    Fun to code