Beruflich Dokumente
Kultur Dokumente
DATE – 21/12/18
Q. Write a program input any lenth and width and find the area of rectangle using call by value(pass the
value and return the value)
Solution-
#include<stdio.h>
#include<conio.h>
void main()
int lenth,width,c;
clrscr();
scanf("%d",&lenth);
scanf("%d",&width);
getch();
int z;
z= x * y;
return(z)}A
Output:-
-
ASSINGMENT-15
DATE- 03/01/19
QUS:- WRITE A PROGRAM INPURT ANY VALUE AND FIND THE SQUARE VALUE
AND USING CALL BY VALUE (RULE2) PASS THE VALUE AND NOT RETURN THE
VALUE.
SOLUTION:-
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
Add();
getch();
void Add()
inta,b,c;
scanf("%d",&a);
c=a+b;
printf("\n addition=%d",c);
RESULT:-
ASSIGNMENT-16
DATE-19/02/2019
SOLUTION.
#include<stdio.h>
#include<conio.h>
void square(int);
void main ()
{
int a;
clrscr();
printf("\n enter any no=");
scanf("%d",&a);
square (a);
getch();
}
void square(int x)
{
int b;
b=x*x;
printf("\n square value=%d",b);
}
Ouput:-
ASSIGNMENT:18
Date:21\12\2018
Que:- write a program input any no and fined the factorial value and using recursion function .
solution
#include<stdio.h>
#include<conio.h>
void main()
int a, i, fv= 1;
clrscr();
scanf("%d",& a);
for(i=1; i<=a;i++)
fv = fv*i;
getch();
}
Output:
ASSINGMENT-19
DATE:- 15\02\2019
SOLUTION:-
#include<stdio.h>
#include<conio.h>
union student
int a,b;
} value;
void main()
clrscr();
fflush(stdin);
scanf("%d",&value.a);
fflush(stdin);
scanf("%d",&value.b);
printf("\n value a=%d",value.a);
getch()
RESULT:-
ASSIGNMENT 20
DATE - 19/02/2019
SOLUTION:-
#include<stdio.h>
#include<conio.h>
void main()
{
int roll;
char name[20],opt;
FILE *fpt;
fpt=fopen("student.dat","w");
clrscr();
do
{
printf("\n enter roll no=");
scanf("%d",&roll);
printf("\n enter name=");
scanf("%s",&name);
fprintf(fpt,"%d %s\n",roll,name);
printf("\n do you want to input any record=(y/n)");
fflush(stdin);
scanf("%c",&opt);
}
while(opt=='y'|| opt=='y');
fclose(fpt);
getch();
}
OUTPUT:-