#include<iostream.h>
#include<conio.h>
void main()
{
int num_last,res=0;
cout<<"Enter the last number : ";
cin>>num_last;
for(int i=0;i<=num_last;i++)
res=res+i;
cout<<"Result is "<<res<<endl;
getch();
}
#includeint main(){int i;for(i=2;i
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;
printf ("x")
Here is an example program: class obj{ public: float p,n,r,si; friend void calc( obj temp); }; void calc( obj temp){ si = (p*n*r)/100; } The initialization and function calling is essential.
#include <iostream> using namespace std; int main() { for(int i = 0; i <= 100; i++) { if(i % 2 != 0) { cout << i << endl; } } char wait; cin >> wait; return 0; }
i dn't know. haha
Yes, this can be done. For example for Fibonacci series. You will find plenty of examples if you google for the types of series you need to be generated.
(xn+2-1)/(x2-1)
10 print "That is not a question." 20 print "That is a command." 30 end
Yes
4 plus 10 plus 16 plus 70 equals 100. To find the sum of this series, simply add all the numbers together.
time in hours second minute
#includeint main(){int i;for(i=2;i
Find the Sum to n terms of the series 5 5+55+555+ +n Terms
if (n%2==0) sum=n/2*(n+1); else sum=(n+1)/2*n;
No.
To swap two variables without using a third variable, use exclusive or manipulation... a ^= b; b ^= a; a ^= b;