Day 2 C
Day 2 C
#include <stdio.h>
int main()
{
int a;
printf("Enter the value of a ");
scanf("%d",&a);
if(a<0) {
a=(-1)*a;
}
#include<stdio.h>
int main()
{
char ch;
printf("Enter any character : ");
scanf("%ch", &ch);
if(ch>='A' && ch<='Z'){
ch=ch+32;
}
else if(ch>='a' && ch<='z'){
ch=ch-32;
}
printf("Convert case of character : %c",ch);
return 0;
}
#include <stdio.h>
int main()
{
int num;
printf("enter the number\n");
scanf("%d",&num);
if(num%2!=0)
{
printf("number is odd %d",num);
}
else
printf("number is even %d",num);
return 0;
}
9. Find the largest and smallest among three numbers supplied by user.
#include<stdio.h>
int main() {
int num1,num2,num3;
printf("enter the value of num1,num2,num3 respectively \n");
scanf("%d%d%d",&num1,&num2,&num3);
//search for greatest number
if(num1>num2 && num1>num3)
{
}
else if(num2>num1 && num2>num3)
{
printf("num2 is the greatest of the two numbers%d",num2);
}
else
{
printf("num3 is greatest of the two numbers%d",num3);
}
//search for smallest numbers
if(num1<num2 && num1<num3)
{
#include<stdio.h>
int main() {
int year;
printf("enter the value of year");
scanf("%d",&year);
11.Compute the telephone bill for Mr. X as per the call rates given below:
Rental = 250
1
st 100 calls @Rs. 0.2
Next 100 calls @ Rs. 0.3
Remaining calls @ Rs. 0.5
#include<stdio.h>
int main()
{
int rental=250,calls,totalbill;
printf("enter the number of call made by Mr X\n");
scanf("%d",&calls);
if(calls<=100)
{
totalbill=rental+ (0.2*calls);
}
else if(calls>100 && calls<=200)
{
totalbill=rental+ (0.2*100)+(0.3*calls);
}
else if (calls>200)
{
totalbill=rental+(0.5*calls)+(0.3*200);
}
printf("your bill is%d \n",totalbill);
return 0;
}
#include <stdio.h>
#include <math.h>
int main() {
double a, b, c, discriminant, root1, root2;
return 0;
}