Tuesday, January 26, 2010

Switch case questions in c









C programming switch case questions and answers with
explanation

1.

What will be output when you will execute following c code?

#include

void main(){

int check=2;

switch(check){

case 1: printf("D.W.Steyn");

case 2: printf(" M.G.Johnson");

case 3:

Saturday, January 23, 2010

If else questions in c







If
else or control flow objective type questions and answers with explanation in c
language for written test or interview









1.








What will be output when you will execute following c code?











#include





void main(){





int a=5,b=10,c=1;





if(a&&b>c){





Monday, January 11, 2010

Write a C program that adds first seven terms of the following series 1/1! +2/2! + 3/3! + ..........

#include< stdio.h>
#include< conio.h>
int main( )
{
int n,i,j,fact;
float sum=0;
clrscr();
for(i=1; i<=7; i++) { fact=1; for(j=i; j>=1; j--) // to find the factorial
fact=fact*j;

sum=sum+(float)i/fact;
}
printf("\nSum : %f",sum);
getch();
return 0;
}

Write a C program to find a peculiar two digit number which is three times the sum of its digits?

example:- 27
=3(2+7)
=3(9)
=27

#include< stdio.h>
#include< conio.h>
int main()
{
int n,sum=0,rem,temp;
clrscr();
printf("Enter any two digit number:");
scanf("%d",&n);
for(temp=n;temp>0;temp=temp/10)
{
rem=temp%10;
sum=sum+rem;
}
if(n==(sum*3))
printf("\nIts a Peculiar two digit number");
else
printf("\nNot a Peculiar two digit number");
getch();
return 0;
}

Sunday, January 10, 2010

C programming tutorials















INDEX
Chapter 1 Memory map
Chapter 2 Data type
Chapter 3 Variables in c
Chapter 4 Operators and expression
Chapter 5 Control structure if else and switch case

C programming questions asked in interview

C questions commonly or frequently asked in
interview for freshers



Check given number is prime number or not using

Check the given number is Armstrong number or not

Check the given number is palindrome number or not

Checking leap year

Check string is palindrome or not

Passing one-dimensional array to a function

Create a file and store data in it

To passing 2-dimensional array to a