C++ LabActivity
C++ LabActivity
#include<iostream>
using namespace std;
int main(){
int m,n,rows;
cout<<"Ener the number of rows:";
cin>>rows;
for( int m=0;m<=rows;m++){
for(int n=0;n<=m;n++){
cout<<n<<" ";
}
cout<<"\n";
}
return 0;
}
___________________________________________________________________________________
___
#include <iostream>
using namespace std;
int main()
{
int rows, coef = 1;
return 0;
}
___________________________________________________________________________________
__________________________
#include <iostream>
using namespace std;
int main()
{
int rows;
return 0;
}
___________________________________________________________________________________
_______________-
#include <iostream>
using namespace std;
int main()
{
int rows, count = 0, count1 = 0, k = 0;
while(k != 2*i-1)
{
if (count <= rows-1)
{
cout << i+k << " ";
++count;
}
else
{
++count1;
cout << i+k-2*count1 << " ";
}
++k;
}
count1 = count = k = 0;
while(k != 2*i-1)
{
cout << "* ";
++k;
}
cout << endl;
}
return 0;
}
___________________________________________________________________________________
___________
#include <iostream>
using namespace std;
int main()
{
int rows;
return 0;
}
___________________________________________________________________________________
_-
#include <iostream>
using namespace std;
int main()
{
int rows;
return 0;
}
______________________________________________________________________________
#include <iostream>
using namespace std;
int main()
{
char input, alphabet = 'A';
cout << "Enter the uppercase character you want to print in the last row: ";
cin >> input;
int main()
{
int rows;
float pi = 3.14159;
// Function to calculate
// Volume of cone
float volume(float r, float h)
{
return (float(1) / float(3)) * pi *
r * r * h;
}
// Function to calculate
// Surface area of cone
float surface_area(float r, float s)
{
return pi * r * s + pi * r * r;
}
// Driver Code
int main()
{
float radius = 5;
float slant_height = 13;
float height = 12;
float vol, sur_area;
float pi=0;
// Function to calculate
// Volume of cone
float volume(float r, float h)
{
return (float(1) / float(3)) * pi * r * r * h;
}
// Function to calculate
// Surface area of cone
float surface_area(float r, float s)
{
return pi * r * s + pi * r * r;
}
// Driver Code
int main()
{
float radius = 5;
float slant_height = 13;
float height = 12;
float vol, sur_area;
cin>>pi;
___________________________________________________________________________________
______________________________
int main()
{
int i, j, n, sum = 0, tsum;
cout << "\n\n Find the sum of the series (1) + (1+2) + (1+2+3) + (1+2+3+4)
+ ... + (1+2+3+4+...+n):\n";
cout <<
"----------------------------------------------------------------------------------
--------\n";
cout << " Input the value for nth term: ";
cin >> n;
for (i = 1; i <= n; i++)
{
tsum = 0;
for (j = 1; j <= i; j++)
{
sum += j;
tsum += j;
cout << j;
if (j < i)
{
cout << "+";
}
}
cout << " = " << tsum << endl;
}
cout << " The sum of the above series is: " << sum << endl;
}