Question:3
Write a function C language to take input for 3 nos check and print largest number?
Sol:
#include <stdio.h>
//function definition
void largest(int p,int q,int r)
{
int m;
if(p>q && p>r)
m=p;
else
if(q>r)
m=q;
else
m=r;
printf("max no = %d",m);
}
int main()
{
int a,b,c;
printf("Enter 3 nos ");
scanf("%d %d %d",&a,&b,&c);
largest(a,b,c);
return 0;
}
Output:
Enter 3 nos 25
96
35
max no = 96
Question:4
Write a function C language to take input for a character check and print whether it an alphabet or not?
Sol:
#include <stdio.h>
#include <stdio.h>
//function definition
void alpha(char ch)
{
if((ch>='A' && ch<='Z') || (ch>='a' && ch<='z'))
printf("it is an alphabet");
else
printf("it is not an alphabet");
}
int main()
{
char ch;
printf("Enter any character ");
scanf("%c",&ch);
alpha(ch);
return 0;
}




