The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we help you to solve your academic and programming questions fast.
Watch related videos of your favorite subject.
Connect with students from different parts of the world.
See Our team
Wondering how we keep quality?
Got unsolved questions?

You are here:Open notes-->Anna-University-->GE2115-Computer-practice-Laboratory-Part-3

# How to study this subject

21. Program to find biggest of two no by using ternary numbers
# include
# include
main( )
{
int a,b,big;
clrscr( );
printf(“enter value a”);
scanf(“%d”,&a);
printf(“enter the value of b”);
scanf(“%d”,&b);
big=(a>b)?a:b;
printf(“biggest of the given numbers IS %d”,big);
getch();
}
22. Program to find biggest of four no by using ternary numbers
# include
# include
main( )
{
int a,b,c,d,big;
clrscr( );
printf(“enter value a”);
scanf(“%d”,&a);
printf(“enter the value of b”);
scanf(“%d”,&b);
printf(“enter the value of c”);
scanf(“%d”,&c);
printf(“enter the value of d”);
scanf(“%d”,&d);
big=(a>b)?(a>c)?(a>d)?a:d:(c>d)?c:d:(b>c)?(b>d)?b:d:(c>d)?c:d;
printf(“biggest of the given 4 numbers IS %d”,big);
getch();
}
23. Program to print smallest of four no by using ternary operators
# include
# include
main( )
{
int a,b,c,d,small;
clrscr( );
printf(“enter value a”);
scanf(“%d”,&a);
printf(“enter the value of b”);
scanf(“%d”,&b);
printf(“enter the value of c”);
scanf(“%d”,&c);
printf(“enter the value of d”);
scanf(“%d”,&d);
small=(a
printf(“biggest of the given 4 numbers IS %d”,small);
getch();
}
24. Program to accept a year and check the given year is leap or not by using ternary
# include
# include
main( )
{
int y,leap;
clrscr( );
printf(“enter any yr”);
scanf(“%d”,&y);
leap=(y%400= =0)?:(y%100!=0)?(y%4= =0)?1:0:0;
if(leap= =1)
printf(“ the given year is leap year”);
else
printf(“given year is not leap year);
getch( );
}
25. Program to accept a character in the uppercase and print in lower case.
# include
# include
main( )
{
char ch,c1;
clrscr( );
printf(“enter a cha in uppercase”);
ch=getchar();
c1=ch+32;
printf(“the given char in lowercasecase is”);
putchar(c1);
getch();
}
26. Program to accept a character in any case and print in another case.
# include
# include
main( )
{
char ch,c1;
clrscr( );
printf(“enter a char in anycase”);
ch=getchar();
if(ch>=65 && ch<=90)
c1=ch+32;
else
if(ch>=97 && ch<=122)
c1=ch-32;
printf(“the given char in anothercase IS”);
putchar(c1);
getch();
} 10
27. Program to natural number from 1 to 10 by using while loop.
# include
# include
main( )
{
int a=0;
clrscr();
while( a<10)
{
a=a+1;
printf(“%d\n”,a);
}
getch();
}
28. Program to accept a string and print it by using the while loop.
# include
# include
main( )
{
char ch;
clrscr();
printf(“enter a string”);
while(( ch=getchar( ))!=’\n’)
putchar(ch);
getch();
}
29. Program to accept a string in upper case and print it by lower case.
# include
# include
main( )
{
char ch,c;
clrscr();
printf(“enter a string in upper case:”);
while(( ch=getchar( ))!=’\n’)
{
c=ch+32;
putchar(c);
}
printf(“ is in lower case”);
getch( );
} 11
30. Program to accept a string in any case and print it by another case .
# include
# include
main( )
{
char ch;
clrscr( );
printf(“enter a string :”);
while(( ch=getchar( ))!=’\n’)
{
if(ch>=’A’ && ch<=’Z’)
putchar(ch+32);
else
if(ch>=’a’ && ch<=’z’)
putchar(ch-32);
else
putchar(ch);
}
printf(“ is the string”);
getch( );
}

# Previous year question papers

## Tool box

Edit this note | Upvote | Down vote | Questions

### Watch more videos from this user Here

Learn how to upload a video and start earning here