c important programs for technical round

Write a program for the given number is palindrome or not?

#include <stdio.h>
#include<conio>
int main()
{
    int n, reversedNumber = 0, rem, originalNumber;

    printf("Enter an Number: ");
    scanf("%d", &n);

    originalNumber = number;

    // reversed Number is stored in variable 
    while( n!=0 )
    {
        remainder = number%10;
        reversedNumber = reversedNumber*10 + rem;
        number /= 10;
    }

    // palindrome if orignalNumber and reversedNumber are equal
    if (originalNumber == reversedNumber)
        printf("%d is a palindrome.", originalNumber);
    else
        printf("%d is not a palindrome.", originalnumber);
    
    return 0;
}

Output

Enter an Number: 2002
2002 is a palindrome.

Write a program for find the factorial of number?


#include<stdio.h>
#include<conio.h>
main(){
int n,r=1;
clrscr();
printf("enter the n value:");
scanf("%d",&n);
for(int i=1;i<=n;i++){

r=r*i;

}
printf("%d",r);
getch();
}

OutPut:

Enter the n value : 4
24
write program for patterns:
Program 1:
#include<stdio.h>
#include<conio.h>
main(){
int k=0,r,c;
clrscr();
for(r=1;r<=4;r++){
for(c=1;c<=r;c++){
printf("%2d",++k);

}
printf("\n");

}
getch();

}

OutPut

1
2 3
4 5 6
7 8 9 10

program2:

#include<stdio.h>
#include<conio.h>

main(){
int r,c;
clrscr();
for(r=1;r<=5;r++){

for(c=1;c<=r;c++){
printf("%d",c);
}
printf("\n");

}

getch();
return(0);

}

Output

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

Program 3:

#include<stdio.h>
#include<conio.h>
main(){
int i,j,k,l;
clrscr();
for(i=5;i>=1;i--){
for(j=5;j>=i;j--){
printf("%d",j);
}
for(k=(i-1)*2;k>=0;k--){
printf(" ");

}
for(l=i;l<=5;l++){
printf("%d",l);
}
printf("\n");

}
getch();
return(0);
}

Output:

5        5
54      45
543    345
5432  2345
5432112345

program(4):

#include<stdio.h>
#include<conio.h>
main(){
int a,b;
char ch=65;
clrscr();
for(a=1;a<=4;a++){
for(b=1;b<=a;b++){
printf("%c",ch);
}
printf("\n");
ch++;
}
getch();

}

Output:

A
B B
C C C
D D D D

program(5):

#include<stdio.h>
#include<conio.h>
main(){
int a,b,c;
clrscr();
printf("enter ther c value:");
scanf("%d",&c);
for(a=1;a<=c;a++){
for(b=1;b<=c-a;b++){
printf(" ");
}
for(b=65;b<=65+a;b++){
printf("%c",b);

}
for(b=64+a;b>=65;b--){
printf("%c",b);

}
printf("\n");

}
getch();
return(0);

}

OutPut:

enter the c value:3
ABA
ABCBA
ABCDCBA

Program(6):

#include<stdio.h>
#include<conio.h>
main(){
int i,j,n,k;
clrscr();
printf("enter the n value::");
scanf("%d",&n);
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf(" ");
}
for(j=64+i;j<=70;j++){
printf("%c",j);
}
for(k=70;k>=65+i;k--){
printf("%c",k);

}
printf("\n");
}
getch();
return(0);
}

OutPut:

ABCDEFFEDCB
BCDEFFEDC
CDEFFED

PROGRAM(7):

#include<stdio.h>
#include<conio.h>
main(){
int a,b,c;
clrscr();
for(a=1;a<=5;a++){

for(b=1;b<=a;b++){
printf("%d",a);
}

for(c=1;c<=a;c++){
printf("%d",a);
}

printf("\n");

}
getch();
}

OutPut:

11
2222
333333
44444444

program(8):

#include<stdio.h>
#include<conio.h>
main(){
int r,c;
clrscr();
for(r=1;r<=5;r++){
for(c=1;c<=5;c++){
if(r==1||c==1){ //
printf("*");
}
}
printf("\n");

}
if(r==5||c==5){
for(c=1;c<=5;c++){
printf("*");
}

}

getch();
}

OutPut:

* * * * *
*
*
*
*


C- most important interview questions for freshers and experienced:

1.Tell me about what you know about c?

2.Explain about static variable?

3. Explain about structure?

4. What is meant by null pointer?

5. Explain about enumerations?

6. What is the full form ANSI?

7.What is meant by recursion?

8.What is meant by the operator?

9. What is a feature of functions?

10. Explain about function?

11. What is function declaration?

12. Explain about Actual arguments?

13. Explain about formal parameter?

14. Explain about a function calle?

Most important programs for java technical round:

1) How many types of memory areas allocated by JVM?

2) How many types of memory areas allocated by JVM?

3) What is JIT Compiler?

4. What is the difference between the Local variable, instance variable?

5) What is a platform?

6)What is the path?

7)What do u know about Java?

8. Without Main the program compile or not?

9. Explain about static variable?

10. Explain about this keyword?

11. explain about Static block?

12. Explain about Static method?

13. Explain about method signature?

14. Explain about Constructor?

15. Explain about arrays?

 

Leave a Reply

Your email address will not be published.