0

CPP to C programming language

Change this code to c programming: #include <iostream> using namespace std; int main() { int a; int b; cout<<"first number: "; cin>>a; cout<<a<<endl; cout<<"second number: "; cin>>b; cout<<b<<endl<<endl; int sum=a+b; int minus=a-b; int multiply=a*b; int divide=a/b; int module =a%b; cout<<a<<"+"<<b<<"="<<sum<<endl; cout<<a<<"-"<<b<<"="<<minus<<endl; cout<<a<<"*"<<b<<"="<<multiply<<endl; cout<<a<<"/"<<b<<"="<<divide<<endl; cout <<a<<"%"<<b<<"="<<module<<endl; return 0; }

1st Mar 2021, 4:29 PM
Mohamed Adan
Mohamed Adan - avatar
1 Odpowiedź
+ 3
Is that a question? Just use the <stdio.h> header instead of <iostream>, remove the namespace import, and replace std::cout with printf() and std::cin with scanf() or other respective input/ output methods. If you know some C++, translating this to C should be fairly simple. And if you need a reference: https://en.cppreference.com/w/c/io
1st Mar 2021, 4:55 PM
Shadow
Shadow - avatar