translate c++ to c codes

Can anyone translate this code plssss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<iostream.h>
#include<conio.h>

void main()
{
    clrscr();
    double amount,res;
    char ch;
    cout<<"Welcome to Bharat Petroleum"<<endl;
    cout<<"Press P for Petrol and D for Diesel:"<<endl;
    cin>>ch;
    {
        if (ch=='P')
            cout<<"Enter your Amount:"<<endl;
        cin>>amount;
        res=(amount/68)*1;
        cout<<"Petrol purchased in litres:"<<endl<<res;
    }
    {
        if (ch=='D')
            cout<<"Enter your Amount:"<<endl;
        cin>>amount;
        res=(amount/48)*1;
        cout<<"Diesel purchased in litres:"<<endl<<res;
    }
    getch();
}
Change the couts to printfs and cins to scanfs and that's about it.
And of course change your libraries to the correct c libraries.

#include<stdio.h>

Hello World in c:

1
2
3
4
5
6
7
8
/* Hello World program */
#include<stdio.h>

int main()
{
    printf("Hello World");
    retun 0;
}

Last edited on
Topic archived. No new replies allowed.