Computer Edu - CLTI

Computer Edu - CLTI CLTI is provide technical education for all.

C program to print the sum of all odd numbers from 1 to your input  number   int main(){    int i, n, sum=0;    /* Input...
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

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

Print Odd Number with C language Program using for loop  main(){    int i, n;    printf("Print odd numbers till: ");    ...
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

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

Loop => Perform same work multiple time then use loop.for(initialization ; condition ; increase/decrease){    // Body of...
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

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

23/06/2022

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

21/06/2022

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

20/06/2022

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

20/06/2022

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;
}

19/06/2022

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

19/06/2022

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

C program Convert days to days, weeks and years  main(){    int d, y, w;    /*Run time Input*/    printf("Enter Number o...
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

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

Address

Alampur
Bhadohi
221401

Alerts

Be the first to know and let us send you an email when Computer Edu - CLTI posts news and promotions. Your email address will not be used for any other purpose, and you can unsubscribe at any time.

Contact The School

Send a message to Computer Edu - CLTI:

Shortcuts

Share