Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Converts theses codes from language c++ to c ( ex: from cin to scanf , cout to printf) (1) #include using namespace std; int main()

Converts theses codes from language c++ to c ( ex: from cin to scanf , cout to printf)
(1)
#include
using namespace std;
int main()
{
int arr[5];
int sum=0;
cout<<"Enter array elements (integer)"<
for (int i=0;i<5;i++)
cin>>arr[i];
for (int i=0;i<5;i++)
sum=sum+arr[i];
int avg=sum/5;
cout<<"Average is "<
}
(2)
#include
using namespace std;
int main()
{
int arr[8];
int even=0,odd=0;
cout<<"Enter 8 integer in array:"<
for (int i=0;i<8;i++)
cin>>arr[i];
for (int i=0;i<8;i++)
if(arr[i]%2==0)
even++;
else
odd++;
cout<<"Number of Even values in array are:"<
cout<<"Number of Odd values in array are:"<
}
(3)
#include
using namespace std;
int main()
{
cout<<"Enter how many elements do you want?"<
int n;
cin>>n;
int arr[n];
cout<<"Enter array element (integer):"<
for (int i=0;i
cin>>arr[i];
int min=arr[0];
for (int i=0;i<=n-1;i++)
{
if(arr[i]<=min&& i!=n-1)
{
min=arr[i];
}
else if(arr[i]<=min && i==n-1)
{
min=arr[i];
}
}
cout<
}
(4)
#include
using namespace std;
int main()
{
int arr[5];
cout<<"Enter 5 integer in array:"<
for (int i=0;i<5;i++)
cin>>arr[i];
cout<<"Reverse array is: "<
for (int i=4;i>=0;i--)
cout<
}
(5)
#include
using namespace std;
int main()
{
int arr[10];
cout<<"Enter 10 integer in array:"<
for (int i=0;i<10;i++)
cin>>arr[i];
cout<<"Enter search key: ";
int key;
cin>>key;
for (int i=0;i<10;i++)
if(arr[i]==key)
cout<<"The key is found at : "<
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Discuss the Rights issue procedure in detail.

Answered: 1 week ago

Question

Explain the procedure for valuation of shares.

Answered: 1 week ago

Question

Which months of this year 5 Mondays ?

Answered: 1 week ago

Question

Define Leap year?

Answered: 1 week ago