Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Can anybody convert my c code to matlab code?Thank you

조회 수: 3 (최근 30일)
Barenya Bikash  Hazarika
Barenya Bikash Hazarika 2018년 6월 19일
마감: MATLAB Answer Bot 2021년 8월 20일
#include<stdio.h>
#define MAX_SIZE 5
int main()
{
int arr[MAX_SIZE]; %Declare an array of MAX_SIZE
int i,j, N;
// Input array size
printf("Enter size of array: ");
scanf("%d", &N);
// Input elements in array
printf("Enter %d elements in the array : ", N);
for(i=0; i<N; i++)
{
scanf("%d", &arr[i]);
}
// Print all elements of array
printf("\nElements in array are: ");
for(i=0; i<N; i++)
{
for(j=i; j<N; j++)
{
printf("%d, ", arr[i,j]);
}
printf("\n");
}
return 0;
}

답변 (1개)

KSSV
KSSV 2018년 6월 19일
  댓글 수: 1
Barenya Bikash  Hazarika
Barenya Bikash Hazarika 2018년 6월 19일
편집: Barenya Bikash Hazarika 2018년 6월 19일
If we put a array size of 5 and elements as 1,2,3,4,5,then the output will be
  • 1 2 3 4 5
  • 2 3 4 5
  • 3 4 5
  • 4 5
  • 5

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by