Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Loops Practise

Wednesday, May 18, 2011

#include <iostream.h>
#include <conio.h>
int main ()
{
    clrscr ();
    long int start=0;
    long int last=0;
    long int a=0;
    cout <<"Enter The First Number: ";
    cin >> start;
    cout <<"\n Enter Second Number : ";
    cin >> last;
    for (int n=last;n>=start;n--)
    {
        if (a==0)
            a=last;
        last=last-1;
        a=a+last;
        n=last;
    }
    cout <<"\n Sum Of All Integers is = " <<a;
    getch();
    return 0;