Please display For loop follow "N" like this result: Enter N=5 5+1=6 4+2=6 3+3=6 2+4=6 1+5=6 ===> Enjoy <===

For Loop

HOME Forums Forum For Loop

This topic contains 1 reply, has 1 voice, and was last updated by  RaksmeyChea 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #909 Reply

    Chheang Sopheaktra

    Please display For loop follow “N” like this result:

    Enter N=5
    5+1=6
    4+2=6
    3+3=6
    2+4=6
    1+5=6

    ===> Enjoy <===

    #910 Reply

    RaksmeyChea
    #include<iostream.h>
    #include<conio.h>
    void main()
    {
       int n;
       cout<<"Enter N: ";	cin>>n;
       for(int i=n;i>=1;i--)
        	cout<<i<<"+"<<((n+1)-i)<<"="<<(i+(n+1)-i)<<endl;
       cout<<"\n===> Enjoy <===";
       getch();
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: For Loop
Your information: