#include<stdio.h>
main()
{
int a,b;
printf("enter the value for a and b\n");
scanf("%d %d",&a,&b);
display(a,b);
}
display(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
printf("%d %d",x,y);
}
To write a C++ program to display the student details using class and array of object.
12
The required c program is given below /*Swapping(interchange) the two entered numbers*/ #include<stdio.h> main() { /*Without using third variable*/ int a,b,t; printf("Enter a:"); scanf("%d",&a); printf("Enter b:"); scanf("%d",&b); a=a+b; b=a-b; a=a-b; printf("\n After swapping without using third variable"); printf("\na=%d\nb=%d",a,b); }
If you had an array int numbers[10]; you would do it like this: CODE: int lowestnumber = numbers[0]; for(int i = 0; i < 10; i++){ if(numbers[i] < lowestnumber) lowestnumber = numbers[i]; } END CODE I think this should work, and in the end the variable lowestnumber will hold the lowest value in the ten. Hope this helps.
pointer is a derived datatype which contains memory addresses as their values. program:- #include<stdio.h> #include<conio.h> void main() { int m=5,*p; clrscr(); p=&m; printf("address of variable m is %p",(void *)p); }
program to find maximum of two numbers using pointers
choosing a variable to represent one of the unspecified numbers in a problem and using it to write expressions for the other unspecified numbers in the problem.
write an assembly language program to find sum of N numbers
To write a C++ program to display the student details using class and array of object.
see : Write_a_shell_program_using_the_if-the-else_to_test_whether_a_variable_name_is_a_directory_or_a_file
i need this answer
Yes. int a, b; a= 2; b= 3; a= a+b;
12
The required c program is given below /*Swapping(interchange) the two entered numbers*/ #include<stdio.h> main() { /*Without using third variable*/ int a,b,t; printf("Enter a:"); scanf("%d",&a); printf("Enter b:"); scanf("%d",&b); a=a+b; b=a-b; a=a-b; printf("\n After swapping without using third variable"); printf("\na=%d\nb=%d",a,b); }
If you had an array int numbers[10]; you would do it like this: CODE: int lowestnumber = numbers[0]; for(int i = 0; i < 10; i++){ if(numbers[i] < lowestnumber) lowestnumber = numbers[i]; } END CODE I think this should work, and in the end the variable lowestnumber will hold the lowest value in the ten. Hope this helps.
swap (int *a, int *b) { *a ^= *b; *b ^= *a; *a ^= *b; }
Please visit http://talentsealed.blogspot.com/2009/10/to-find-sqaure-of-numbers-using-c.htmlfor the answer.