Name - Memane Mahesh Balu College - Idol Class - Fymca Subject - C Programming
Name - Memane Mahesh Balu College - Idol Class - Fymca Subject - C Programming
COLLEGE
- IDOL
CLASS
- FYMCA
SUBJECT
- C PROGRAMMING
SR. NO
1
2
3
4
ASSIGNMENT NO 3
DATE
13.11.2011
13.11.2011
13.11.2011
13.11.2011
ASSIGNMENT
ASSIGNMENT NO 1
ASSIGNMENT NO 2
ASSIGNMENT NO 3
SIGNATURE
Page 1
ASSIGNMENT NO 3
Page 2
ASSIGNMENT NO 3
Page 3
ASSIGNMENT NO 3
Page 4
ASSIGNMENT NO 3
Page 5
Output
enter two numbers :12 100
Original values : a=12 and b=100
Inside call by value function:
value of a=100 and b=12
values after call by balue function : a=12 and b=100
values after call by ref function : a=100 and b=12
ASSIGNMENT NO 3
Page 6
Page 7
printf("ans =%d",f);
break;
case 4:
printf("enter a no ");
scanf("%d",&g);
printf("enter a no to shift");
scanf("%d",&h);
i=g<<h;
printf("\n%d left shift%d ",g,i);
j=g>>h;
printf("\n%d right shift%d ",g,j);
}
getch();
}
Output:
Enter 2 no.s
24 66
enter 1-Arithmatic opr,
2-Relation opr,
3-Ternary opr,
4-Bitwise1
enter 1-add,
2-sub,
3-multiply,
4-divide2
subtracton =42
ASSIGNMENT NO 3
Page 8
ASSIGNMENT NO 3
Page 9
7.
-----------------------------------------------------------------------------#include<stdio.h>
#include<conio.h>
void main()
{
int n,j;
int fact(int);
int (*ptr)(int);
clrscr();
ptr=&fact;
printf("Enter the number\n");
scanf("%d",&n);
j=(*ptr)(n);
printf("The factorial of number %d is %d",n,j);
getch();
}
int fact(int x)
{
int i,f;
f=1;
for(i=1;i<=x;i++)
{
f=f*i;
}
return f;
}
Output:
Enter the number
5
The factorial of number 5 is 120
ASSIGNMENT NO 3
Page 10
Page 11
printf("\n");
}
getch();
}
OUTPUT:
ASSIGNMENT NO 3
Page 12
ASSIGNMENT NO 3
Page 13
void main()
{
clrscr();
static struct Book obj={"Prog in C","G. S. Baluja", 2011};
display(obj);
getch();
}
ASSIGNMENT NO 3
Page 14
123asdf
bnknk
^Z
Data Output
123asdf
bnknk
ASSIGNMENT NO 3
Page 15
OUTPUT:
Enter first filename:file1
Enter second filename:file2
Cannot open file1 for reading
ASSIGNMENT NO 3
Page 16