MASTER OF COMPUTER APPLICATIONS
Course Code: MCS-011
Course Title : Problem Solving and Programming
Assignment Number : MCA(1)/011/Assign/2017-18
Maximum Marks : 100
Write a program to find the largest element in an array using Recursion – IGNOU MCA Assignment 2017 – 18
Program:
#include<stdio.h>
void main()
{
int ARRAY[]={1,2,3,4,5,6,7,8,9,0};
int I,*PTR,SUM=0;
clrscr();
PTR=&ARRAY;
while(*PTR)
{
SUM = SUM + *PTR;
PTR++;
}
printf(“SUM OF ARRAY IS = %d”,SUM);
getch();
}
Code:
[codesyntax lang=”c”]
#include<stdio.h>
void main()
{
int ARRAY[]={1,2,3,4,5,6,7,8,9,0};
int I,*PTR,SUM=0;
clrscr();
PTR=&ARRAY;
while(*PTR)
{
SUM = SUM + *PTR;
PTR++;
}
printf(“SUM OF ARRAY IS = %d”,SUM);
getch();
}
[/codesyntax]
Screen Shots: