Take BCA Tuition from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Write a program to exchange the first element with the last element of an array.

Asked by Last Modified  

Follow 0

Please enter your answer


IN C Prog: void swap(int *arr,int length) { int a; /*Third Variable*/ a = *arr; *arr = a; arr = a; } In Java: int (int arr) { int a; int len = arr.length; int ar = arr; a = ar; ar = a; ar = ar; return ar; }

Maths and Computer Science Tutor with 10 years Teaching experience

import java.io.*; import java.util.*; class SawpArray() { public static void main(String args) { int array = new int; int length = array.length; for(int i = 0; i < length; i++) { array = (int)(Math.random()*5); System.out.print(array); } System.out.println(""); ...
read more
import java.io.*; import java.util.*; class SawpArray() { public static void main(String[] args) { int[] array = new int[5]; int length = array.length; for(int i = 0; i < length; i++) { array[i] = (int)(Math.random()*5); System.out.print(array[i]); } System.out.println(""); SwapFirstAndLast(array); } public static void SwapFirstAndLast(int[] array) { for(int i=0;iread less

Computer Wizard

public void swap(int arr) { int temp; temp=arr.length-1; arr.length-1=arr; arr=temp; System.out.println("print array elements") }


#include iostream using namespace std; int main() { int a,temp; for(int i=0;i less than10;i++) //scan array { cin>>a; } for(int i=0;i>a; } temp=a; a=a; a=temp; for(int i=0;i>a; } return 0; }
read more
#include iostream using namespace std; int main() { int a[10],temp; for(int i=0;i less than10;i++) //scan array { cin>>a[i]; } for(int i=0;i<10;i++) //print scanned array { cout>>a[i]; } temp=a[0]; a[0]=a[9]; a[9]=temp; for(int i=0;i<10;i++) //print exchanged array { cout>>a[i]; } return 0; } read less

Selenium Java Dealer ( SDET )

public class Arr { public static void main(String args) { // TODO Auto-generated method stub int a={2,4,6,8,10,12,15}; for(int i=0;i<=a.length;i++) { int d=a; a=a; a=d; System.out.println(a); } } }

Java developer

swap them

16 Yrs of Experience in Teaching

tmp=a; a=a; a=tmp;

God Gifted Mathematicians with more than 21 years of experience

Temp= a B=a A= temp

Java/J2ee,C,C++,DBMS Expert

import java.util.Arrays; public class ExchangeArrayElement { public static E void exchangeArrayElement( E arr){ int length = arr.length; for(int i=0,j=length-1;i read more
import java.util.Arrays; public class ExchangeArrayElement { public static E void exchangeArrayElement( E[] arr){ int length = arr.length; for(int i=0,j=length-1;iread less

International Corporate Trainer For dotnet Core ,Angular 2 ,C ,C++ and LPT Marathi for RBI Banking

You should learn Networking and hardware by joining profesional training institute and BCA degree is just for show case. It is useless

View 19 more Answers

Related Questions

give me best coaching center in karnal of bca if anyone person who will give me best guideces with studies
you can search by google also. but best will be to touch your senior for best answer.
Is it correct to do BCA and MCA?
Yes it is great if you r really interested in computer field ..after BCA you can go either for job or for mca ...after mca definitely you will have a great path waiting for you
0 0
Which is the best college in Delhi for a BCA?
Amity University, Noida Jamia Millia Islamia, Delhi Maharaja Agrasen Institute of Technology, Delhi. Are some of the best colleges
0 0
Which stream in an MBA is best after a BCA?
You can opt MBA IT...else MCA is also good after BCA if you have intrest in programing.
0 0
How to create project in vb6.0?
Welcome to Free Visual Basic 6 (VB6) tutorial for beginners. This Visual Basic 6 (VB6) tutorial helps you to learn Visual Basic 6.0 (VB6) programming in your own. Assuming you all are beginners to visual...

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Components of Digital Marketing
Content marketing Search Engine Optimization (SEO) Paid Search (PPC) Email marketing Social Media Marketing Digital Display Marketing (Ad Ops) Web Analytics and Reporting Mobile Marketing 30...

Do You Know How Is Size Of Structure Defined?
Size of the structure is defined based on multiplies of bigger data type member in the structure. Example: If a structure contains integer, char, short data type, then size of the Structure will be multiples...

Networking Basic
Networking interview questionsWhat is LAN?LAN is a computer network that spans a relatively small area. Most LANs are confined to a single building or group of buildings. However, one LAN can be connected...

Dynamic Memory Allocation in C using malloc()
#include <stdio.h>#include <conio.h>//#include <malloc.h> OR#include <stdlib.h>void main(){ int *ptr, i, n, sum = 0; printf("how many elements ? "); scanf("%d", &n);...

National level ICT exam- Tanzania-IGCSE board national exam- Grade 9th
A sample question paper of IGCSE board national exam - Tanzania: Candidate’s No……………………………. MINISTRY OF EDUCATION AND...

Recommended Articles

Once over with the tenth board exams, a heavy percentage of students remain confused between the three academic streams they have to choose from - science, arts or commerce. Some are confident enough to take a call on this much in advance. But there is no worry if as a student you take time to make choice between - science,...

Read full article >

With the mushrooming of international and private schools, it may seem that the education system of India is healthy. In reality, only 29% of children are sent to the private schools, while the remaining head for government or state funded education. So, to check the reality of Indian education system it is better to look...

Read full article >

Learning for every child starts from a very young age. While the formal methods include school curriculums and private lessons, the informal methods include dancing, music, drawing, and various fun-filling activities. Playing games and practising these types of activities helps the children get out of boredom and...

Read full article >

Appearing for exams could be stressful for students. Even though they might have prepared well, they could suffer from anxiety, tension etc. These are not good for their health and mind. However, following a few exam preparation tips can save them from all these and help them to score good marks. Let’s find out all...

Read full article >

Looking for BCA Tuition ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you

Looking for BCA Tuition Classes?

The best tutors for BCA Tuition Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Take BCA Tuition with the Best Tutors

The best Tutors for BCA Tuition Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more