Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
What the error Or problem you are facing...?
31st Dec 2022, 11:16 AM
Jayakrishna 🇮🇳
+ 1
In loop, use semi colon ; (not comma,) to separate blocks.. edit: #include <iostream> using namespace std; int main(){ int n; cin >> n; //size of the array int *nums = new int[n]; for (int i=0; i<n; i++) { // edit cin >> nums[i]; } int max = nums[0]; for(int i=0; i<n; i++) { if(nums[i]>max) max = nums[i]; } cout << max; }
31st Dec 2022, 11:18 AM
Jayakrishna 🇮🇳