Home
Suva Programming
Home
SAP
Home
CPP
sum of natural numbers using loop
sum of natural numbers using loop
Suva Programming
Wednesday, January 29, 2020
Source Code:
#include<iostream>
using namespace std;
int main()
{
int i,s,n;
cout<<"Enter one integer: ";
cin>>n;
for(i=1;i<=n;i++)
{
s=n*(n+1)/2;
}
cout<<s;
return 0;
}
Program Output:
Post a Comment
0 Comments
Categories
CPP
(64)
Java
(4)
Java Virtual Machine
(1)
SAP
(58)
Shell Programming
(4)
Popular Posts
Simple SAP Program to store records in an internal table
Friday, March 28, 2025
SAP Program to implement control break statement "AT FIRST"
Wednesday, February 21, 2024
SAP Program to show multiple keyword's operation,
Sunday, June 01, 2025
Contact Form
Name
Email
*
Message
*
0 Comments