Make a program that will accept an integer and loop from 1 to that integer. Then, print all numbers from that range that are greater than 3.
The first lines will contain message prompts to input the decimal numbers.
The last line contains the sum of all negative numbers with 3 decimal places.
Example Output:
Enter n:8
4
5
6
7
8
#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int i,n;
cout<<"\nEnter an integer:"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
if(i>3)
{
cout<<i;
}
}
getch();
return 0;
}
Comments
Leave a comment