English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

1.) you are going to ask the values of the rows and column respectively. And for each row the larger number will be displayed first then so on (or in descending fashion). For which the output will look like this:
Results:

How many rows: 3

How many columns: 5

The output is as follows:

Row 1: 5 4 3 2 1

Row 2: 5 4 3 2 1

Row 3: 5 4 3 2 1

--------------------------------------------------

2.) you are going to input an integer number between 1 to 100. In which the output will look like this:

Results:

Enter an integer between 1 and 100: 15

1 2 3 4 5 6 7 8 9 10

11 12 13 14 15

The sum is: 120

2007-03-23 20:41:24 · 3 answers · asked by auray l 1 in Computers & Internet Programming & Design

3 answers

Hey Dude,i have written this on Linux,i think program will compile on win too...

Here is the Programs Code:
1.
#include
#include
using namespace std;
int main() {
unsigned int row=0,col=0;
std::cout<<"How Many rows:";cin>>row;
std::cout<<"How Many column:";cin>>col;
for(int i=1;i<=row;i++) {
std::cout<<"Row "<<" "< for(int j=col;j>0;j--) {
std::cout< }
std::cout< }
return 0;
}

2.

#include
using namespace std;
int main() {
unsigned int sum=0;
int count=0,n=0;
std::cout<<"Enter the count:";std::cin>>count;
std::cout<<"Enter the numbers:"< for(int i=0;i cin>>n;
sum += n;
}
std::cout<<"Sum:"< return 0;
}

please let me know if u get into trouble while running this.

2007-03-23 21:22:35 · answer #1 · answered by Anonymous · 0 0

I gave only pseudo code, write the real code by yursels. And i dont know if this true or not Im not tested it
1
int row,col
for (i=row;i--)
{
print i;
for (j=col;j--)
{
print j;
}
}

2
int input, sum
sum=0;
if ((input<0)||(input>100))
print 'Error!'
else
{
for (i=1;i++)
{
print 'i ';
sum+=i;
}
print sum;
}

Hope this help

2007-03-24 04:16:10 · answer #2 · answered by must_zen 5 · 0 0

obviously this is a programming assignment for school, please do not ask someone else to do your homework.

2007-03-24 03:57:29 · answer #3 · answered by chameleon_.geo 3 · 0 0

fedest.com, questions and answers