Huawei
Company
Programming
Program
i faced technical round-2
write programs
1.Factorial Using recurrsion
2.integer array make reverse with out using Temporary/additional array
3.oops supported concept with one example
4.print the numbers below format
1
1 2
1 2 3
1 2 3 4
5.print the below format using two array
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
==>L.R:1 3 5 7
==>R.L:4 4 4 4
6.Bubble sort
insert sort in below format
{4,2,9,6,23,12,34,0,1}
Read Solution (Total 4)
-
- factorial using recursion
include
int fact(int);
int main(){
int num,f;
printf("nEnter a number: ");
scanf("%d",&num);
f=fact(num);
printf("nFactorial of %d is: %d",num,f);
return 0;
}
int fact(int n){
if(n==1)
return 1;
else
return(n*fact(n-1));
} - 11 years agoHelpfull: Yes(3) No(2)
- 3.An object in OOP has state and some behavior. In Java, the state is the set of values of an object's variables at any particular time and the behaviour is implemented as methods. A class can be defined as a group of objects with the same structure and behaviour. Class can be considered as the blueprint or a template for an object and describes the properties and behavior of that object, but without any actual existence. An object is a particular instance of a class which has actual existence and there can be many objects (or instances) for a class. In the case of a car or laptop, there will be a blueprint or design created first and then the actual car or laptop will be built based on that. We do not actually buy these blueprints but the actual objects. Static variables and classes are an exception to this rule that they belong to class and exist when the class is loaded before objects are created. Hence static variables and methods are considered as not purely object oriented. Even then, everything in Java, including static variables and methods, should be part of a class or interface and there can be no global variables or functions like in some other languages. We will restrict our discussion in this article to classes only.
- 11 years agoHelpfull: Yes(1) No(0)
- /* program to get output like this
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
*/
#include
void main()
{
int i,n,j;
printf("Enter number");
scanf("%d",&n);
for(i=1;i - 10 years agoHelpfull: Yes(0) No(5)
- 3.#include
int main()
{
int a[8]={1,2,3,4,5,6,7,8};
int k;
printf("Weclome to IndiaBIX.com..!");
for(k=0;k=0;k--)
printf("%d",a[k]);
return 0;
}
- 10 years agoHelpfull: Yes(0) No(5)
Huawei Other Question