someone help me make a program about this triangle.......
* * * * *
_ * * * *
_ _ * * *
_ _ _ * *
_ _ _ _ *
can someone show me the code for this program using
"FOR LOOPS"
please.....
thanks.....
someone help me make a program about this triangle.......
* * * * *
_ * * * *
_ _ * * *
_ _ _ * *
_ _ _ _ *
can someone show me the code for this program using
"FOR LOOPS"
please.....
thanks.....
post the code you have written and we'll try to help you.
but i cant create a code for this triangle...
sorry but i dont know...
can you help me make one?...
please.....
Didn't your momma ever tell you that "can't never did anything". What's the first thing you have to do? Answer: write a program with main() function. Next: create a loop that counts from 0 to 5. Do you know what a loop is? If not, then read your textbook and it will tell you with examples.
i know ok ill make....
this is the code for a left triangle i know.....
#include<iostream.h>
main()
{
int x;
int y;
int z;
for(x=0;x<6;x++){
for(y=6;y>x;y--){
cout<<" ";
}
for(z=0;z<y;z++){
cout<<" * ";
}
cout<<"\n\n\n";
}
getchar();
return 0;
}
this is the figure....
_ _ _ _ *
_ _ _ * *
_ _ * * *
_ * * * *
* * * * *
ill have this triangle but im using SPACING to create this......
someone help me make a program about this triangle.......
* * * * *
_ * * * *
_ _ * * *
_ _ _ * *
_ _ _ _ *
can someone show me the code for this program using
"FOR LOOPS"
Please find program below:
#include <iostream>
#include <string>
using namespace std;
#define FOR_LOOPS cout << "* * * * *\n_ * * * *\n_ _ * * *\n_ _ _ * *\n_ _ _ _ *";
int main()
{
FOR_LOOPS
cin.get();
return 0;
}
>>ill have this triangle but im using SPACING to create this......
That's what you're supposed to do. Just reverse the order of the spaces and start, and you should get what you want.
can you give me the code that your talking about please.....
>>can you give me the code that your talking about please.....
I could, but I won't. Try to do this yourself so that you will learn something. Afterall, isn't that what school is all about?
but i really dont know how to do this in reverse >_<
Did you write that code you posted or not? My guess is you got it from someone else. Study the code and think about what it is doing. Then see if you can see how to rearrance a few lines to make it do what you want it to do. If you don't understand the program you posted then I don't know how we can help you.
#include <stdio.h>
main()
{
const int N = 5;
int Value[N];
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
if( i > j )
printf("-");
else
printf("*");
}
printf("\n");
}
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.