Adding Two numbers using float and integer data

নিম্নের সোর্সকোডের মাধ্যমে পূর্ণসংখ্যাকে(Integer) এবং বাস্তব সংখ্যাকে(real number) কিভাবে যোগ করা যায় এবং তা প্রিন্ট(show) করা যায় তা শেখা যাবে । ভেরিয়েবল এবং ডাটা টাইপ সম্পর্কে বিস্তারিত বুঝার জন্য ভিজিট করুন:  http://www.cprogramming-bd.com/tutorial/c_tutorial_page_6.aspx

Problem: Write a program which performs addition on two numbers and display the result. Use float and Integer data type

Source Code:

#include<stdio.h>
main()
{
  int number;
  float amount;
  //integer data representation
  number=100+10;
  //float data representation
  amount =30.75 +  75.35;
  printf("%d\n", number);
  printf("%5.2f",amount);
}


Output:
110
106.10

<< Go to Index Page >>

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

  1. //The problem solve by using "scanf"...the value will be calculate by manually.

    #include
    #include
    main()
    {
    double a,b,number,amount;
    number=100;
    printf("Enter the value of 1st amount: \n");
    scanf("%lf",&a);
    printf("Enter the value of 2nd amount: \n");
    scanf("%lf",&b);
    amount=a+b;
    printf("The number is: %lf\n",number);
    printf("The amount is: %0.2lf\n",amount);
    return 0;
    }

    উত্তরমুছুন
  2. #include"stdio.h"
    main(){
    float a,b,sum;
    printf("Enter One number : \n");
    scanf("%f",&a);
    printf("Enter Another number : \n");
    scanf("%f",&b);
    sum=a+b;
    printf("The sum of two numbers is %.2f \n",sum);
    }

    উত্তরমুছুন
  3. #include
    main()
    {
    int a,b,sum=0;
    scanf("%d",&a);
    scanf("%d",&b);
    sum=a+b;
    printf("%d",sum);

    }

    উত্তরমুছুন
  4. #include
    main()
    {
    int a,b,result;
    printf("Enter the value of A\n");
    scanf("%d",&a);
    printf("Enter the value of B\n");
    scanf("%d",&b);
    result=a+b;
    printf("The result is %d",result);

    }

    উত্তরমুছুন
  5. # include
    main ()
    {
    int hadu=100;
    float jodu=4.7,modu=5.3,sadu=0;
    sadu=jodu+modu;
    printf("hadu of nambur: %d\n", hadu);
    printf("sadu of two numbers: %f\n", sadu);
    return 0;
    }

    উত্তরমুছুন
  6. # include
    main ()
    {
    int hadu=100;
    float jodu=4.7,modu=5.3,sadu=0;
    sadu=jodu+modu;
    printf("hadu of nambur: %d\n", hadu);
    printf("sadu of two numbers: %f\n", sadu);
    return 0;
    }

    উত্তরমুছুন
  7. #include"stdio.h"
    main(){
    float a,b,sum;
    printf("Enter One number : \n");
    scanf("%f",&a);
    printf("Enter Another number : \n");
    scanf("%f",&b);
    sum=a+b;
    printf("The sum of two numbers is %.2f \n",sum);
    }

    উত্তরমুছুন
  8. //adding two numbers in c++
    #include
    using namespace std;
    main()
    {
    int a,b,c=0;
    cout<<"Enter 1st element"<>a;
    cout<<"Enter 2nd element"<>b;
    c=a+b;
    cout<<"The sum is "<<c;
    }

    উত্তরমুছুন
  9. #include

    void main()
    {
    int firstN, secondN, totalN;
    printf("Enter two numbers to add \n");
    scanf("%d%d",&firstN,&secondN);
    totalN = firstN + secondN;
    printf("Total Number is= %d\n",totalN);

    }

    উত্তরমুছুন
  10. sonia ferdusi
    id-201410285

    #include
    void main()
    {
    int a=13,b=13;
    int sum=0;
    cin("%d",&a);
    cin("%d",&b);
    sum=a+b;
    cout("%d",&sum);
    }

    উত্তরমুছুন



  11. //adding two numbers in c++
    #include
    #include
    #include

    using namespace std;
    main()
    {
    int a,b,sum=0;
    cout<<"Enter 1st element"<>a;
    cout<<"Enter 2nd element"<>b;
    sum=a+b;
    getch();
    }
    Bikash Chandra Sutrodhor
    ID: 201410108
    Batch: 45th

    উত্তরমুছুন
  12. //adding two numbers in c++
    #include
    #include
    #include
    using namespace std;
    main()
    {
    int a,b,c=0;
    cout<<"Enter 1st element"<>a;
    cout<<"Enter 2nd element"<>b;
    c=a+b;
    cout<<"The sum is "<<c;
    getch();
    return 0;
    }
    Sumonto Kumer Ghosh
    ID : 201410848
    Batch : 45th

    উত্তরমুছুন
  13. //adding two numbers in c++

    #include"stdio.h"
    main()
    {
    int c,d,sum=0;
    scanf("%d",&c);
    scanf("%d",&d);
    sum=c+d;
    printf("%d",sum);

    }

    Kobir Ahammad
    ID: 201411044
    Batch: 45th

    উত্তরমুছুন
  14. main()
    {
    int a,b,sum:
    cout<<"Enter Your First Value";
    cin>>a;
    cout<<"Enter Your Second Value";
    cin>>b;
    sum=a+b;
    cout<<"Sum of Two Numbers is"<<sum;
    cout<<sum<<endl;
    }

    উত্তরমুছুন
  15. Rubel(201410530)

    #include
    using namespace std;
    int main()
    {
    int p, r, S;
    cout<<"Enter two number to add\n";
    cin >> p >> r;
    S=p+r;
    cout<<"Sum of entered numbers="<<S<< end1;
    return 0;
    }

    উত্তরমুছুন
  16. fehir(201520314)


    #include
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
    }

    উত্তরমুছুন
  17. #include
    using namespace std;

    int main(){
    int a, b;
    cout<<"Enter two numbers:" ;
    cin>>a>>b;

    int result = a+b;

    cout<<endl<<"The result is: " <<result <<endl;


    return 0;
    }

    উত্তরমুছুন
  18. Appel mahmud akib. Id:201510384

    #include
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b<<endl;
    }

    উত্তরমুছুন
  19. #include
    using namespace std;

    int main ()
    {
    int a,b;
    cout<<"Enter two number:" ;
    cin>>a>>b;

    int result =a+b;
    cout <<"the result is: "<<result;
    return 0;
    }

    উত্তরমুছুন
  20. #include
    using namespace std;

    int main ()
    {
    int a,b;
    cout<<"Enter two number:" ;
    cin>>a>>b;

    int result =a+b;
    cout <<"the result is: "<<result;
    return 0;
    }

    উত্তরমুছুন
  21. #include
    using namespace std;

    int main ()
    {
    int a,b;
    cout<<"Enter two number:" ;
    cin>>a>>b;

    int result =a+b;
    cout <<"the result is: "<<result;
    return 0;
    }

    উত্তরমুছুন
  22. #include
    using namespace std;
    int main()
    {
    int num1, num2, result;
    cout<<"Enter two numbers: ";
    cin>>num1>>num2;
    cout<<endl;
    result=num1+num2;
    cout<<"RESULT: "<<result<<endl;
    }

    উত্তরমুছুন
  23. #include
    using namespace std;
    int main()
    {
    int num1, num2, result;
    cout<<"Enter two numbers: ";
    cin>>num1>>num2;
    cout<<endl;
    result=num1+num2;
    cout<<"RESULT: "<<result<<endl;
    }

    উত্তরমুছুন
  24. using c++

    #include

    using namespace std;

    double func(double i, double j)
    {
    return i+j;
    }

    int main()
    {
    double a, b;
    cout << "Enter first value --:";
    cin >> a;
    cout << "Enter second value --:";
    cin >> b;
    cout << "Total value of two number --: " << func(a, b) << "\n";
    return 0;
    }

    উত্তরমুছুন
  25. Name: Tareq Aziz
    ID : 201531141


    #include

    using namespace std;

    int main() {
    double a,b, total;
    cout<<"Enter Two number"<>a>>b;
    total=a+b;
    cout<<"Total : "<< total;
    }

    উত্তরমুছুন
  26. #include

    using namespace std;

    int fun(int i, int j)
    {
    return i+j;
    }
    int main()
    {
    int i, j;
    cout << "Enter first number: ";
    cin >> i;
    cout << "Enter second number: ";
    cin >> j;
    cout << "Addition between two number is: " << fun(i, j);
    return 0;
    }

    উত্তরমুছুন
  27. using C++
    #include

    using namespace std;
    int main()
    {
    int a,b;
    int result;
    cin>>a;
    cin>>b;
    result =a+b;
    cout<<result;
    return 0;
    }

    উত্তরমুছুন
  28. using C++
    #include

    using namespace std;
    int main()
    {
    int a,b;
    int result;
    cin>>a>>b;
    result =a+b;
    cout<<result;
    return 0;
    }

    উত্তরমুছুন
  29. using c++

    #include
    using namespace std;

    int main()
    {
    int a,b,sum;
    cout<<"Enter two number to add";
    cin>>a>>b;
    sum=a+b;
    cout<<"sum of the number"<<sum;
    return 0;
    }

    উত্তরমুছুন
  30. #include
    using namespace std;

    int main()
    {
    double A,B,SUM;

    cout <<"Enter the number of A: "<< endl;
    cin >>A;
    cout <<"Enter the number of B: "<< endl;
    cin >>B;
    SUM = A+B;
    cout <<"The sum is: "<<SUM<< endl;
    return 0;
    }



    id:201510660

    উত্তরমুছুন
  31. #include
    using namespace std;

    int main()
    {
    double A,B,SUM;

    cout <<"Enter the number of A: "<< endl;
    cin >>A;
    cout <<"Enter the number of B: "<< endl;
    cin >>B;
    SUM = A+B;
    cout <<"The sum is: "<<SUM<< endl;
    return 0;
    }

    id: 201510992

    উত্তরমুছুন
  32. #include
    using namespace std;

    int main()
    {
    double A,B,SUM;

    cout <<"Enter the number of A: "<< endl;
    cin >>A;
    cout <<"Enter the number of B: "<< endl;
    cin >>B;
    SUM = A+B;
    cout <<"The sum is: "<<SUM<< endl;
    return 0;
    }

    উত্তরমুছুন
  33. #include
    #include
    Void main()
    {
    int a,b,c;
    cout<<"Enter two numbers"<>a>>b;
    c=a+b;
    cout<<"Sum of two numbers are"<<c;
    cout<<c<<endl;
    getch();
    }

    উত্তরমুছুন
  34. #include
    #include
    Void main()
    {
    int a,b,c;
    cout<<"Enter two numbers"<>a>>b;
    c=a+b;
    cout<<"Sum of two numbers are"<<c;
    cout<<c<<endl;
    getch();
    }

    উত্তরমুছুন
  35. #include
    using namespace std;
    int main()
    {
    int a,b,sum;
    float c,d,add;
    cout<<"Enter Integer values"<>a>>b;
    sum=a+b;
    cout<<"Sum of integer values is :"<>c>>d;
    add=c+d;
    cout<<"Sum of Float values is :"<<add<<endl;
    }

    উত্তরমুছুন
  36. #include
    using namespace std;
    int main(){
    int a,b,sum=0;
    cout<<"enter the first number="<>a;
    cout<<"enter the second number="<>b;
    sum+=a+b;
    cout<<"the sum of the two number is ="<<sum<<endl;
    }

    উত্তরমুছুন
  37. #include
    int main(){
    int a;
    float b,sum;
    printf("enter the integer number=");
    scanf("%d",&a);
    printf("enter the float number=");
    scanf("%f",&b);
    sum=a+b;
    printf("%.2f\n",sum);

    }

    উত্তরমুছুন
  38. mausumi sumi

    #include
    using namespace std;
    int main(){
    int a,b,c;
    cout<<"enter two number to add\n";
    cin>>a>>b;
    c=a+b;
    cout<<"sum of entered number="<<c<<endl;
    }

    উত্তরমুছুন
  39. #include
    int main()
    {
    int a,b,sum;
    printf("Enter Your Values\n");
    scanf("%d %d",&a,&b);
    sum=a+b;
    printf("%d",sum);
    return 0;

    }

    উত্তরমুছুন
  40. #include
    int main()
    {
    int a,b,sum;
    printf("Enter Your Values\n");
    scanf("%d %d",&a,&b);
    sum=a+b;
    printf("%d",sum);
    return 0;

    }

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