Practical Examination Question Paper
Data Structure Using C Language
BCA - P1
Marks: 75
- Write a Program to Find the Largest and the smallest from the Given Three Integers.
#include<Stdio.h>
#include<conio.h>
void main ()
{
int a,b,c;
clrscr();
printf("Enter the Three Value\n\n");
scanf("%d%d%d", &a,&b,&c);
printf("\nThe Largest Number\n\n");
if( (a>b)&&(a>c) )
printf("A is Greater");
else if (b>c)
printf("B is Greater");
else
printf("C is Greater");
printf("\n\n");
printf("\nThe Smallest Number\n\n");
if( (a<b) && (a<c))
printf("A is Smaller");
else if (b<c)
printf("B is Smaller");
else
printf("C is Smaller");
getch();
}
or
2. Write a Program to print the square and Cube of n natural numbers using while Loop
Answer:
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,k;
clrscr();
printf("Enter the Number range: Start Value, End value: \n");
scanf("%d%d",&i,&j);
printf("Following list shows the square & cube value\n");
k=i;
while(k<=j)
{
printf("\n%d \t %d\t%d",k,k*k,k*k*k);
k++;
}
getch();
}
________________________________________________________________________
#include<conio.h>
main()
{
int i,j,k;
clrscr();
printf("Enter the Number range: Start Value, End value: \n");
scanf("%d%d",&i,&j);
printf("Following list shows the square & cube value\n");
k=i;
while(k<=j)
{
printf("\n%d \t %d\t%d",k,k*k,k*k*k);
k++;
}
getch();
}
________________________________________________________________________
Parthal matum Pothathu - "KEEP PRACTICING"
No comments:
Post a Comment