answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

void main()

{

int rollno,m1,m2,m3,m4,m5,tot;

float avg;

char [20]name;

clrscr();

printf("Enter the name,rollno,mark");

scanf("%d%d%d%d%d%d%s",&rollno,&m1,&m2,&m3,&m4,&m5,&name);

tot=m1+m2+m3+m4+m5;

avg=tot/5;

printf("the avg is",avg);

getch();

}

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

Program in c using pointers to interchange 2 values without using third variable?

swap (int *pa, int *pb) { *pa ^= *pb; *pa ^= *pa; *pa ^= *pb; }


10 When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

As for pointers, I think you have to readjust them. Pointers are just variables that store a memory address in them. You can have as many pointers that point to a single location in memory as you want.


Can you run java program without applying main method?

yes we can run java program without using main. we can run program by declaring the variable static..


Write a c program to add 2 no without using plus operator?

You can make use of pointers to achieve this.void add( int *a, int *b){(*a) += (*b);}Now if two numbers a and b are given and you need to store the value in variable c, then you would perform:c = a;add(&c,&b);


Why are they no pointers in java?

Pointers are a crucial feature of several programming languages, including C and C++, that allow direct manipulation of memory addresses. Pointers are used to create dynamic data structures, access memory directly, and create efficient algorithms. However, pointers are not available in the Java programming language. In this article, we will explore why pointers are not present in Java and the advantages and disadvantages of this decision. The main reason why pointers are not present in Java is security. Pointers allow direct access to memory addresses, which can be used to manipulate memory in unexpected ways. In Java, memory is managed automatically by the Java Virtual Machine (JVM), which helps to prevent accidental or intentional manipulation of memory. This is important for security, as malicious code could use pointers to gain unauthorized access to sensitive data or systems. By removing pointers, Java ensures that all memory access is controlled and managed, which helps to prevent security threats. Another reason why pointers are not present in Java is the ease of use. Pointers are a complex feature that can be difficult for beginner programmers to understand and use effectively. Java was designed to be an easy-to-use programming language, and by removing pointers, Java makes it easier for beginners to write correct, secure code. Java also makes it easier for programmers to write portable code, as the absence of pointers ensures that code written in Java will work on any device that supports the Java Virtual Machine. However, the absence of pointers in Java also has some disadvantages. One of the main disadvantages is that Java can be slower than languages that support pointers, as the automatic memory management provided by the JVM can be less efficient than direct memory manipulation. When handling large amounts of data, the JVM may not be able to allocate memory as efficiently as a programmer working directly with pointers. When working with pointers, a programmer has complete control over the memory allocation and can optimize it for their specific use case. Another disadvantage of the absence of pointers in Java is that some algorithms and data structures cannot be implemented as efficiently as they can be in languages that support pointers. For example, binary trees can and linked lists and are implemented more efficiently in C or C++, as they can use pointers to link nodes together in memory. Java must use other techniques, such as object references, to implement these structures, which can result in slower and less efficient code. In conclusion, the absence of pointers in Java was a deliberate decision made to improve the security and ease of use of the language. This decision has both advantages and disadvantages, as Java is easier to use and more secure, but it can be slower and less flexible than languages that support pointers. Nevertheless, the popularity of Java and its widespread use in industry and academia demonstrate that the benefits of the absence of pointers outweigh the drawbacks.

Related Questions

What are void pointers?

They are pointers without type


Why laser mouse are used?

Because the laser pointers are much easier to use than the ball pointers. The ball pointers are often difficult to move around while the laser pointers can move in any direction without "getting stuck"


Program in c using pointers to interchange 2 values without using third variable?

swap (int *pa, int *pb) { *pa ^= *pb; *pa ^= *pa; *pa ^= *pb; }


What is the difference between a matriculated and non-matriculated student in terms of their enrollment status at the university?

A matriculated student is officially enrolled in a degree program at the university and is working towards completing the requirements for that program. A non-matriculated student is not enrolled in a degree program and may be taking courses for personal interest or professional development without working towards a degree.


What are the c-programs for indexed fileallocation without pointers?

Home-works.


Who made the most 3 pointers in a basketball game without missing?

Michael Jordan


How long does it take to earn a bachelor's degree without an associate's degree?

The bachelors degree it designed as a four year program of study as a full-time student, and provided the student takes the degree as prescribed by the college or university.


Is it possibly to return an array of strings in a function without using pointers in C plus plus?

No.


Who is important a student or a teacher?

Both because a teacher cannot teach without a student and a student cannot learn without a teacher.


Student with books are different in student without books?

student with books are more knowledge than students without books because students without books is less knowledge.


Is it possible to make a program using for and not with while?

The following cases are all possible:- program without any for and while- program without for- program without while- program with both for and while


What do you need to qualify for student loans without cosigner?

Student loans are provided without consigner based on needs. For example if you are independent from your parents, you can qualify for student loans without cosigner.