Bài tập 49: Cho số nguyên dương n. Hãy tìm chữ số đầu tiên của n

Bài tập 49: Cho số nguyên dương n. Hãy tìm chữ số đầu tiên của n

Dạng bài tập này giúp các bạn giỏi về: Lưu đồ thuật toán

Bài tập 49: Cho số nguyên dương n. Hãy tìm chữ số đầu tiên của n

Cài đặt

#include<stdio.h>
#include<conio.h>

int main()
{
    int themang, n, i;

    do
    {
        printf("\nNhap n: ");
        scanf("%d", &n);
    }while(n < 0 && printf("\nLoi: (n >= 0)"));

    themang = n;
    /*do
    {                                 
        i = themang % 10;
        themang /= 10;
    }while(themang != 0);*/                
    
    //có thể viết
    do
    {
      i = themang % 10;
    }while(themang /= 10);
    
    printf("\nChu so dau tien la %d", i);

    getch();
    return 0;
}
Bạn thấy bài viết này như thế nào?: 
Average: 10 (8 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
5 điểm lưu ý trong quảng cáo Google Adwords năm 2013

5 điểm lưu ý trong quảng cáo Google Adwords năm 2013

Sau nhiều năm phát triển Internet, có thể nói năm 2010 – 2012 là thời gian lan tỏa của công nghệ Internet tại Việt Nam và nhiều nước khác. Do sự phát triển quá mạnh mẽ, bộ máy làm việc của các công cụ tìm kiếm phải cập nhật liên tục, đặc biệt là Google.

Hướng dẫn drush Self Aliases

Hướng dẫn drush Self Aliases

I ran into an interesting problem with the drush @self alias today. I wanted to pull a fresh copy of the DB down from a client’s live site to my local development copy. Should be as easy as drush sql-sync @clientsite.live @self, right? I’ve done this a thousand times before.

And I’ve also ignored the warning message every time before, but today I thought I’d check it out:

Hướng dẫn hiển thị profile G+ trên kết quả tìm kiếm

Hướng dẫn hiển thị profile G+ trên kết quả tìm kiếm

Trước đây, khi Google chưa cho phép dùng profile G+ làm hình ảnh đại diện trên kết quả search, mọi người thường dùng Rich Snippets để làm hiển thị hình ảnh, logo trên kết quả tìm kiếm. Rất đơn giản, chỉ cần chèn vào website đoạn code sau :

Công ty diệt chuột T&C

 

Diet con trung