thank you Write a complete C program that asks the user for


thank you!!

Write a complete C+ + program that asks the user for a number n and prints 2 large copies of an t Pattern (each with height n that is odd! in a horizontal sequence. For example, if the user specified 5 for n, the program would print us follows: (Each E pattern should begin after a gap of one column after the previous one ends Do not try to check whether the laser input is legal or sensible) Write a complete CM ++ program that prints the: numbers from 980 down to 669 with 6 numbers (separated by periods) on each line. The output from your program should begin 980.979.978.977.976.975 974.973.972.971.970.969

Solution

Problem 12

#include<iostream>
using namespace std;
int main()
{
int n, c, d;
cout<<\"\ Enter the value of n: \";
cin>>n;
for(c = 0; c < 5; c++)
{
//For even position n number of starts
if(c % 2 == 0)
{
for(d = 0; d < n; d++)
cout<<\"*\";
//One column gap
cout<<\" \";
for(d = 0; d < n; d++)
cout<<\"*\";
}
//For odd position 1 start
else
{
cout<<endl<<\"*\";
//Space for the next single star
for(d = 0; d < n; d++)
cout<<\" \";
cout<<\"*\"<<endl;
}
}
}

Output 1:

Enter the value of n: 5
***** *****
* *
***** *****
* *
***** *****

Output 2:

Enter the value of n: 7
******* *******
* *
******* *******
* *
******* *******

Problem 13

#include<iostream>
using namespace std;
int main()
{
int r, c = 0;
//Loops from 980 to 669 reverse order
for(r = 980; r >= 669; )
{
//Each line will contain 6 numbers
if(c == 6)
{
//If counter is 6 then next line
cout<<endl;
//Reset the counter for next 6 numbers
c = 0;
}
else
{
if(c == 5)
//If it is last number then no dot symbol
cout<<r;
else
cout<<r<<\".\";
c++;
r--;
}
}
}

Output:

980.979.978.977.976.975
974.973.972.971.970.969
968.967.966.965.964.963
962.961.960.959.958.957
956.955.954.953.952.951
950.949.948.947.946.945
944.943.942.941.940.939
938.937.936.935.934.933
932.931.930.929.928.927
926.925.924.923.922.921
920.919.918.917.916.915
914.913.912.911.910.909
908.907.906.905.904.903
902.901.900.899.898.897
896.895.894.893.892.891
890.889.888.887.886.885
884.883.882.881.880.879
878.877.876.875.874.873
872.871.870.869.868.867
866.865.864.863.862.861
860.859.858.857.856.855
854.853.852.851.850.849
848.847.846.845.844.843
842.841.840.839.838.837
836.835.834.833.832.831
830.829.828.827.826.825
824.823.822.821.820.819
818.817.816.815.814.813
812.811.810.809.808.807
806.805.804.803.802.801
800.799.798.797.796.795
794.793.792.791.790.789
788.787.786.785.784.783
782.781.780.779.778.777
776.775.774.773.772.771
770.769.768.767.766.765
764.763.762.761.760.759
758.757.756.755.754.753
752.751.750.749.748.747
746.745.744.743.742.741
740.739.738.737.736.735
734.733.732.731.730.729
728.727.726.725.724.723
722.721.720.719.718.717
716.715.714.713.712.711
710.709.708.707.706.705
704.703.702.701.700.699
698.697.696.695.694.693
692.691.690.689.688.687
686.685.684.683.682.681
680.679.678.677.676.675
674.673.672.671.670.669

 thank you!! Write a complete C+ + program that asks the user for a number n and prints 2 large copies of an t Pattern (each with height n that is odd! in a hor
 thank you!! Write a complete C+ + program that asks the user for a number n and prints 2 large copies of an t Pattern (each with height n that is odd! in a hor
 thank you!! Write a complete C+ + program that asks the user for a number n and prints 2 large copies of an t Pattern (each with height n that is odd! in a hor

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site