Python:
cost = int(input('Cost per 1 kg is\n>>'))
print('Cost for 150g is {}'.format(cost * 0.15))
print('Cost for 300g is {}'.format(cost*0.3))
print('Cost for 3 kg is {}'.format(cost*3))
C++:
#include <iostream>
int main(){
int cost;
std::cout<<"Cost per 1 kg is\n>>";
std::cin>>cost;
std::cout<<"For 150g is "<<cost*0.15<<"\n";
std::cout<<"For 300g is "<<cost*0.3<<"\n";
std::cout<<"For 3 kg is "<<cost*3<<"\n";
return 0;
}
Python:
cost = int(input('Cost per 1 kg is\n>>'))
print('Cost for 150g is {}'.format(cost * 0.15))
print('Cost for 300g is {}'.format(cost*0.3))
print('Cost for 3 kg is {}'.format(cost*3))
C++:
#include <iostream>
int main(){
int cost;
std::cout<<"Cost per 1 kg is\n>>";
std::cin>>cost;
std::cout<<"For 150g is "<<cost*0.15<<"\n";
std::cout<<"For 300g is "<<cost*0.3<<"\n";
std::cout<<"For 3 kg is "<<cost*3<<"\n";
return 0;
}