//Write a C Program to convert lower case to upper case and vice versa

#include<stdio.h>
void main()
{
char ch;
printf(“Enter the Character:”);
scanf(“%c”,&ch);
if(islower(ch))
printf(“%c”,toupper(ch));
else
printf(“%c”,tolower(ch));

}

//Write a C Program to display the ASCII value with characters

#include<stdio.h>
void main()
{
int Num;
for(Num=0;Num<=255;Num++)
printf(“%d=%c\n”,Num,Num);
}

//Write a program to calculate the factorial of a Numbers

#include<stdio.h>
void main()
{
int fact=1,Num,i;
printf(“Enter the Number:”);
scanf(“%d”,&Num);
for(i=Num;i>1;i–)
fact=fact*i;
printf(“Factorial of %d is %d”,Num,fact);
}

//Write a program to swap a two number without using extra variables

#include<stdio.h>
void main()
{
int a,b;
printf(“\nEnter two numbers:”);
scanf(“%d %d”,&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf(“a=%d,b=%d”,a,b);
}

//Write a program to get the salary and gender as a input and calculate the bonus 7% for male and 10 % for female . In addition to that 5% extra bonus for the employee salary less than 10000

#include<stdio.h>
void main()
{
float salary,bonus=0;
char gen;
printf(“Enter the salary and gender:”);
scanf(“%f %c”,&salary,&gen);
if(gen==’M’ || gen==’m’)
bonus=bonus+salary*0.07;
else
bonus=bonus+salary*0.10;
if(salary<10000)
bonus=bonus+salary*0.05;
salary=salary+bonus;
printf(“Salary=%f, Bonus=%f”,salary,bonus);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s