//First Program using While Loop
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); // clear the screen
int first, input, total;
cout<<“Enter the first input”;
cin>>first; // takes the first input
total=first;
cout<<“Total is :” <<total;
while(total<(first*10))
{
cout<<“Enter the input”;
cin>>input; //takes input
total=total+input; //calculates new total
cout<<“New Total is : “<<total;
}
getch(); // holds output screen until user press a key
}
// Second Program using For Loop
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); // clear the screen
int first, input, total;
cout<<“Enter the first input”;
cin>>first; // takes the first input
cout<<“Total is :” <<first;
for(total=first ;total<(first*10); )
{
cout<<“Enter the input”;
cin>>input; //takes input
total=total+input; //calculates new total
cout<<“New Total is : “<<total;
}
getch(); // holds output screen until user press a key
}
//First Program using While Loop using printf and scanf
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); // clear the screen
int first, input, total;
printf(“Enter the first input”);
scanf(“%d”,&first); // takes the first input
total=first;
printf(“Total is : %d”,first);
while(total<(first*10))
{
printf(“Enter the input”);
scanf(“%d”,&input); //takes input
total=total+input; //calculates new total
printf(“New Total is : %d”,total);
}
getch(); // holds output screen until user press a key
}
// Second Program using For Loop using Printf and Scanf
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr(); // clear the screen
int first, input, total;
printf(“Enter the first input”);
scanf(“%d”,&first); // takes the first input
printf(“Total is : %d”,first);
for(total=first ;total<(first*10); )
{
printf(“Enter the input”);
scanf(“%d”,&input); //takes input
total=total+input; //calculates new total
printf(“New Total is : %d”,total);
}
getch(); // holds output screen until user press a key
}