0% found this document useful (0 votes)
9 views

lab4i

The document contains a C++ program that calculates the fuel required for a given distance. It prompts the user to enter a distance, then computes the fuel needed based on a fixed rate of 10 units of fuel per distance unit. If the calculated fuel is less than 100, it outputs 100 as the fuel requirement.

Uploaded by

fattima.afzal456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

lab4i

The document contains a C++ program that calculates the fuel required for a given distance. It prompts the user to enter a distance, then computes the fuel needed based on a fixed rate of 10 units of fuel per distance unit. If the calculated fuel is less than 100, it outputs 100 as the fuel requirement.

Uploaded by

fattima.afzal456
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream>

using namespace std;


void fuel(int dist);
main()
{
int dist;
cout<<"enter distance: ";
cin>>dist;
fuel(dist);
}
void fuel(int dist)
{
int Fuel;
Fuel=dist*10;
if(Fuel<100){
cout<<"fuel is: 100";
}
else{
cout<<"fuel is: "<<Fuel;
}
}

You might also like