#include <iostream>
using namespace std;
void leftRotate(int arr[], int d, int n)
{
for (int z = 0; z < d; z++)
{
int temp = arr[0], i;
for (i = 0; i < n - 1; i++)
arr[i] = arr[i + 1];
arr[i] = temp;
}
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
}
int rotateArray(int num, int x)
{
return x;
}
int main()
{
int arr[100], n, d, numbers;
cin >> n >> d;
for (int i = 0; i < n; i++)
cin >> arr[i];
leftRotate(arr, d, n);
numbers = rotateArray(numbers, d);
return 0;
}
using namespace std;
void leftRotate(int arr[], int d, int n)
{
for (int z = 0; z < d; z++)
{
int temp = arr[0], i;
for (i = 0; i < n - 1; i++)
arr[i] = arr[i + 1];
arr[i] = temp;
}
for (int i = 0; i < n; i++)
cout << arr[i] << " ";
}
int rotateArray(int num, int x)
{
return x;
}
int main()
{
int arr[100], n, d, numbers;
cin >> n >> d;
for (int i = 0; i < n; i++)
cin >> arr[i];
leftRotate(arr, d, n);
numbers = rotateArray(numbers, d);
return 0;
}
how will i know which ques answer is where
ReplyDeleteThis comment has been removed by the author.
ReplyDelete80 percent only
ReplyDeleteAR5 answer:
ReplyDelete#include
int main() {
int MAX =50;
int array[MAX], i, largest1, largest2;
int n,j,temp;
float mean,sum;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&array[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(array[i]<array[j])
{
temp=array[i];
array[i]=array[j];
array[j]=temp;
}
}
}
largest1=array[0];
largest2=array[1];
sum=largest1+largest2;
mean=(sum)/2;
printf("%.1f",mean);
return 0;
}
gandu
Delete80
ReplyDelete