নিম্নের সোর্সকোডের মাধ্যমে পূর্ণসংখ্যাকে(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 >>
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 >>
//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;
}
well done
উত্তরমুছুন#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);
}
#include
উত্তরমুছুনmain()
{
int a,b,sum=0;
scanf("%d",&a);
scanf("%d",&b);
sum=a+b;
printf("%d",sum);
}
#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);
}
# 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;
}
# 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;
}
#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);
}
//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;
}
#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);
}
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);
}
উত্তরমুছুন//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
//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
//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
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;
}
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;
}
fehir(201520314)
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return 0;
}
#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;
}
Appel mahmud akib. Id:201510384
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
#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;
}
#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;
}
#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;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
}
#include
উত্তরমুছুনusing namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
}
#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;
}
#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;
}
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;
}
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;
}
#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;
}
using C++
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b;
int result;
cin>>a;
cin>>b;
result =a+b;
cout<<result;
return 0;
}
using C++
উত্তরমুছুন#include
using namespace std;
int main()
{
int a,b;
int result;
cin>>a>>b;
result =a+b;
cout<<result;
return 0;
}
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;
}
#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
#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
#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;
}
#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();
}
#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();
}
#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;
}
#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;
}
#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);
}
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;
}
#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;
}
#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;
}