Computer Edu - CLTI
CLTI is provide technical education for all.
Learn website design and development - https://www.clti.in/courses/wordpress-elementor/
Computer Edu - CLTI CLTI is provide technical education for all.
02/08/2022
C program to print the sum of all odd numbers from 1 to your input number
int main()
{
int i, n, sum=0;
/* Input Number to find sum of odd numbers */
printf("Enter a number to add range all odd number: ");
scanf("%d", &n);
for(i=1; i
CLTI | Computer Institute in Bhadohi Are you intersted in learn computer, CLTI is a one of the best place learn computer in Bhadohi, Computer intitute where you change your future
19/07/2022
Print Odd Number with C language Program using for loop
main()
{
int i, n;
printf("Print odd numbers till: ");
scanf("%d", &n);
printf("Odd numbers from 1 to %d are: \n", n);
for(i=1; i
CLTI | Computer Institute in Bhadohi Are you intersted in learn computer, CLTI is a one of the best place learn computer in Bhadohi, Computer intitute where you change your future
30/06/2022
Loop => Perform same work multiple time then use loop.
for(initialization ; condition ; increase/decrease)
{
// Body of for loop statement
}
// using for loop to print 1-100 number
int main()
{
int num; // variable declare
for(num=1; num
CLTI | Computer Institute in Bhadohi Are you intersted in learn computer, CLTI is a one of the best place learn computer in Bhadohi, Computer intitute where you change your future
switch case programe in C language
int main()
{
int weekday;
/* Input week number from user */
printf("Enter weekday number(1-7): ");
scanf("%d", &weekday);
switch(weekday)
{
case 1:
printf("Monday");
break;
case 2:
printf("Tuesday");
break;
case 3:
printf("Wednesday");
break;
case 4:
printf("Thursday");
break;
case 5:
printf("Friday");
break;
case 6:
printf("Saturday");
break;
case 7:
printf("Sunday");
break;
default:
printf("Invalid input! Please enter between 1-7 number.");
}
return 0;
}
www.clti.in
Profit / loss Program in C language
int main()
{
int costp,sellingp, amount;
printf("Enter cost price: ");
scanf("%d", &costp);
printf("Enter selling price: ");
scanf("%d", &sellingp);
if(sellingp > costp)
{
amount = sellingp - costp;
printf("Profit = %d", amount);
/* Calculate Profit */
}
else if(costp > sellingp)
{
amount = costp - sellingp;
printf("Loss = %d", amount);
/* Calculate Loss */
}
else
{
printf("No Profit No Loss.");
/* Neither profit nor loss */
}
return 0;
}
www.clti.in
Check Max Number ino your given two number
int main()
{
int n1, n2;
printf("Please enter two numbers: ");
scanf("%d%d", &n1, &n2);
if(n1 > n2)
{
printf("Maximum is %d", n1);
}
else
{
printf("Maximum is %d", n2);
}
return 0;
}
www.clti.in
Check number is positive/negative
int main()
{
int number;
printf("Enter any number: ");
scanf("%d", &number);
if(number > 0)
{
printf("Number is POSITIVE");
}
if(number < 0)
{
printf("Number is NEGATIVE");
}
if(number == 0)
{
printf("Number is ZERO");
}
return 0;
}
Check Odd/Even Program in C language
int main()
{
int n;
printf("Enter any number to check even / odd: ");
scanf("%d", &n);
if(n % 2 == 0)
{
/* number % 2 is 0 */
printf("Number is Even.");
}
else
{
/* number % 2 is 1 */
printf("Number is Odd.");
}
return 0;
}
www.clti.in
Use if in C language
Check greater number between two number ----
int main()
{
int number_one, number_two;
printf("Enter two numbers: ");
scanf("%d%d", &number_one, &number_two);
/* Check num1 is maximum */
if(number_one > number_two)
{
printf("%d is maximum", number_one);
}
/* Check num2 is maximum */
if(number_two > number_one)
{
printf("%d is maximum", number_two);
}
/* If Number is Equal */
if(number_one == number_two)
{
printf("Both are equal");
}
return 0;
}
www.clti.in
09/06/2022
C program Convert days to days, weeks and years
main()
{
int d, y, w;
/*Run time Input*/
printf("Enter Number of days: ");
scanf("%d", &d);
y = (d / 365);
w = (d % 365) / 7;
d = d - ((y * 365) + (w * 7));
/*Print*/
printf("YEARS: %d\n", y);
printf("WEEKS: %d\n", w);
printf("DAYS: %d", d);
}
www.clti.in
CLTI | Computer Institute in Bhadohi Are you intersted in learn computer, CLTI is a one of the best place learn computer in Bhadohi, Computer intitute where you change your future
Click here to claim your Sponsored Listing.
Category
Contact the school
Website
Address
Alampur
Bhadohi
221401