This was checked for C++ using VS2008.
#include
using std::cin;
using std::cout;
using std::endl;
int main()
{
cout << endl << "Enter of digits in the last number of the patter "
<< endl << "(should be odd number, if you enter even number N," << endl << "the answer will have N - 1 digits in the last number): ";
int numElem = 0;
cin >> numElem;
cout << endl << "Pattern:" << endl;
for (int i = 1; i <= numElem; i += 2)
{
for (int j = 1; j <= i; j++)
{
cout << j;
}
cout << endl;
}
system("PAUSE");
return 0;
}
For just C you might want to use something like (not tested):
#include
int main()
{
cout << endl << "Enter of digits in the last number of the patter "
<< endl << "(should be odd number, if you enter even number N,"
<< endl << "the answer will have N - 1 digits in the last number): ";
int numElem = 0;
cin >> numElem;
cout << endl << "Pattern:" << endl;
for (int i = 1; i <= numElem; i += 2)
{
for (int j = 1; j <= i; j++)
{
cout << j;
}
cout << endl;
}
system("PAUSE");
return 0;
}
class logic
{
public static void main(String args[])
{
int a,b;
for(a=1;a<=5;a++)
{
for(b=1;b<=a;b++)
System.out.print(b+" ");
}
}
}
System.out.println("1234 123 12 1 12 123 1234");
Or write two nested loops for the descending sequence, and then again two nested loops for the ascending sequence, printing one digit at a time, and using print() instead of println().
public class apples {
public static void main(String argc[]) {
System.out.println("12321");
}
}
for (int i=0; i<5; ++i) { System.out.print (i+1);
System.out.print (' ');
System.out.print (5-i);
System.out.print (' ');
}
Use a nested loop:
int x, y;
for (x=1; x<=5; ++x)
for (y=1; y<=x; ++y)
System.out.print(y);
please just take this program off of my computer . I need to take care of things and I can not do them if this program is in operation. a thank you
No
can you please send me a sample program of college examination using sql?thanks...God bless...
Please specific the question. Because I'm about to say for the answer: any.
There is insufficient information in the question to properly answer it. You did not provide details of the "following circuit". Please restate the question.
please just take this program off of my computer . I need to take care of things and I can not do them if this program is in operation. a thank you
No. Sometimes you need a program. But PLEASE PLEASE PLEASE PLEASE PLEASE do not download those programs.
No
Please don't write "the following" if you don't provide a list.
Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?Please restate your question. What are the "following"? What are the choices? Why don't you simply read your history book?
Please include the "following locations" in your question.
Yes, please do.
The program has to answer my question please!
You say the following: "Please, Swartznegger, please!"
I ALSO WANT TO KNOW!what is meant by object program?PLEASE TELL ME THE ANSWER.
That sentence makes no sense, but, "Give you that disk, please."
Please restate your question. What are the "following"?