C++ Program for Float and Double Data Type

Master C++ with Real-time Projects and Kickstart Your Career Start Now!!

Program 1

#include<iostream>
#define clrscr() system("cls")
using namespace std;
int main()
{
    clrscr();
    cout<<"15/2: "<<15/2<<endl;
    cout<<"15.0/2: "<<15.0/2<<endl;
    cout<<"15/2.0: "<<15/2.0<<endl;
    cout<<"15.0/2.0: "<<15.0/2.0<<endl;
//   int h,e,c,m,total;
//   float per;
//   clrscr();
//   cout<<"Enter marks of 4 subject";
//  cin>>h>>e>>c>>m;
//  total=(h+e+c+m);
//  cout<<"\nTotal Marks : "<<total;
//  per=total/4.0;
//  cout<<"\nPercentage: "<<per;
//     return 0;
}

Program 2

#include<iostream>
#define clrscr() system("cls")
using namespace std;
int main()
{
    float r,A,C;
    const float PI=3.14f;
    clrscr();
    cout<<"\nEnter redious of circle";
    cin>>r;
    A=PI*r*r;
    C=2*PI*r;
    cout<<"Area is : "<<A;
    cout<<"\nCircumfrance is : "<<C;
 return 0;
 }

 

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *