সমস্যা

#include<iostream>
using namespace std;
int main()
{
    int n;
    while(cin>>n){
    for(int i =0;n>i;n--){
        cout<<n<<" ";
        cout<<endl;
    }
    return 0;
}

asked 20 Dec '18, 15:36

pollob1563's gravatar image

pollob1563
2076

edited 20 Dec '18, 16:11

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
74618


সংখ্যাটি থেকে উল্টোদিকে ১ পর্যন্ত প্রিন্ট করলেই হবে।

scanf("%d",&n);
for ( ; n>0; n--) {
    printf("%d", n);
    if (n>1) printf(" ");   //শেষ সংখ্যার শেষে স্পেস প্রিন্ট হবে না।
}
permanent link

answered 20 Dec '18, 16:00

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
74618

scanf("%d", &n);

while(n) {
    printf("%d", n--);

    if(n) {
        putchar(' ');
    }
}
putchar('\n');
permanent link

answered 20 Dec '18, 18:33

sourav_hossain's gravatar image

sourav_hossain
1548

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×131
×7
×5

question asked: 20 Dec '18, 15:36

question was seen: 523 times

last updated: 20 Dec '18, 18:33