Bài tập 45: Hãy tính tích các chữ số của số nguyên dương n

Bài tập 45: Hãy tính tích các chữ số của số nguyên dương n

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

Hãy tính tích các chữ số của số nguyên dương n

Cài đặt

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
    int themang, n;
    int P;

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

    while(themang != 0)
    {
        P = P * (themang % 10);
        themang = themang / 10;
    }
    printf("\nTich la %d", P);

    getch();
    return 0;
}
Bạn thấy bài viết này như thế nào?: 
Average: 6.1 (7 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

 
Confirms 4 câu hỏi về việc: Designers Aren't Clear How To Help Drupal 8

Confirms 4 câu hỏi về việc: Designers Aren't Clear How To Help Drupal 8

Below are the questions that were asked and some of the great takeaways I personally gathered from the answers given. Moving forward this information will be extremely helpful in creating a solution to the existing problems of not enough designers getting involved.

10 Tips to improve Android Phone Battery Life

10 Tips to improve Android Phone Battery Life

Maximize Android battery life in order to get the most out of your new phone. Here are some tips on how to improve Android battery life. 

Một số hàm thao tác với shortcode trong wordpress

Một số hàm thao tác với shortcode trong wordpress

Bài viết thực hiện dựa trên tài liệu Wordpress ở phiên bản 3.5.1. Shortcode được giới thiệu từ phiên bản 2.5, nó sẽ thực hiện một số chức năng nào đó bằng việc tạo một đoạn mã theo cú pháp trong nội dung bài viết

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

 

Diet con trung