Arithmatic Operation

Write and run a program that reads a six digit integer and prints the sum of its six digits. Use the quotient operator(/) and the remainder operator(%) to extract the digit from the integer. For example, if N is the integer 876543 then n/1000%10 is its thousands digit 6.

<< Go to Index Page >>

16 মন্তব্যসমূহ

  1. #include
    main()
    {
    int i, j, n=100000, sum=0;
    while(scanf("%d", &i)==1)
    {
    while(i>0)
    {
    j=i/n;
    i=i%n;
    n=n/10;
    sum+=j;
    }
    printf("%d\n", sum);
    sum=0;
    n=100000;
    }
    return 0;
    }

    উত্তরমুছুন
  2. It is a continuous program. never end if you don't close the exe window. For that reason, getch() is useless.

    উত্তরমুছুন
  3. #include"stdio.h"
    main(){
    int a,i,sum=0,count=0;
    scanf("%d",&a);
    if(a!=0){
    while(a>0){
    i=a%10;
    a=a/10;
    sum+=i;
    count++;
    }
    printf("Sum is %d\n",sum);
    printf("Number of digit is %d\n",count);
    }
    }

    উত্তরমুছুন
  4. #include
    main()
    {
    int x,y,k=0;
    printf("Enter the number");
    scanf("%d",&x);
    while(x>0)
    {
    y=x%10;
    k=k+y;
    x=x/10;
    }
    printf("%d",k);
    getch();
    }

    উত্তরমুছুন
  5. NAME:Mahmuda sultana
    ID:201330499
    #include
    using namespace std;
    class A
    {
    public:
    int i,sum=0,count=0;
    int get_inp(int a)
    {
    b=a;
    }
    protected:
    int b;
    };
    class B:public A
    {
    public:
    int arithmatic()
    {
    if(b!=0)
    {
    while(b>0)
    {
    i=b%10;
    b=b/10;
    sum+=i;
    count++;
    }
    cout<<"Sum is:"<>a;
    bb.get_inp(a);
    bb.arithmatic();
    return 0;
    }

    উত্তরমুছুন
  6. Summer 2017
    ID#201610042

    Answer to Question No 7:
    https://drive.google.com/file/d/0B99eePh0LV8gLVY0YndXQmdPMzg/view?usp=drivesdk

    উত্তরমুছুন
  7. ID : 201620195
    https://drive.google.com/open?id=0B9K31ospCyFjVkdHOXE3Y001a1k

    উত্তরমুছুন
  8. https://drive.google.com/open?id=0BzTqZMBWR6eObXRtaW5JOWhiQjA

    উত্তরমুছুন
  9. https://drive.google.com/open?id=0B8369pAqjVVpdHBPMnhLZ2RIb3M

    উত্তরমুছুন
  10. ID:201520552
    https://drive.google.com/open?id=0B5pG0kIjzgEKU2c1N010dloyWEk

    উত্তরমুছুন
  11. ID 201610456
    MD USUF MIA
    https://drive.google.com/open?id=0B_PIGnOMR0K2Nk9UbU90NjFmN3M

    উত্তরমুছুন
  12. ID 201610456
    MD USUF MIA
    without using any loop
    https://drive.google.com/open?id=0B_PIGnOMR0K2RUh0TW5GZ3d4c1k

    উত্তরমুছুন
  13. Id= 201710494
    https://www.dropbox.com/s/p5u5fzl67jpfnow/prob%207.cpp?dl=0

    উত্তরমুছুন
  14. https://drive.google.com/open?id=0Byxq3aat_mNSd19RWWdTNlZIQU0

    উত্তরমুছুন
  15. https://drive.google.com/open?id=0B3bVD5Ppt_STUjJJcmEydTBJbEU

    উত্তরমুছুন
নবীনতর পূর্বতন