যেমনঃ নাম্বার যদি হয় ১০০, প্রথম ডিজিট ১ বের করবো কিভাবে?

asked 26 Nov, 17:23

_Shaon_'s gravatar image

_Shaon_
624112


>>> n = 100
>>> str = str(n)
>>> str[0]
'1'
>>>
permanent link

answered 26 Nov, 17:44

menon's gravatar image

menon
3.9k222

#include <stdio.h>
int main()
{
    int num;
    scanf("%d",&num);
    while (num>=10) {
        num /= 10;
    }
    printf("%d\n",num);
    return 0;   
}

উত্তরটা ইতোমধ্যে মেনন ভাই দিয়েছেন। যারা পাইথন জানে না তাদের জন্য আমার উত্তর।

permanent link

answered 26 Nov, 18:18

Mosharraf%20Hosain's gravatar image

Mosharraf Hosain ♦
9618

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:

×18

question asked: 26 Nov, 17:23

question was seen: 76 times

last updated: 26 Nov, 18:18