K

@karthikeyasharma000

Write a C program to print all even numbers between 1 to 100.

C
4 years ago
#include<stdio.h> int main(){ int i; for (i=1;i<=100;i++){ if(i%2==0){ printf("%d\n",i); } } }

Write a C program to print all alphabets from a to z.

C
4 years ago
#include<stdio.h> int main(){ char ch='a'; for(ch='a';ch<='z';ch++){ printf("%c\n",ch); } }

Write a C program to print all natural numbers in reverse (from n to 1)

C
4 years ago
#include<stdio.h> int main(){ int n=20,i; for(i=n;i>=1;i--){ printf("%d\n",i); } }

Write a C program to print all natural numbers from 1 to n. - using while

C
4 years ago
#include<stdio.h> int main(){ int n=20,i; for(i=1;i<=n;i++){ printf("%d\n",i); } }

Program to create calculator using

C
4 years ago
#include<stdio.h> int main(){ float n1=3,n2=5; char op='+'; float result =0; switch(op){ case '+': result=n1+n2; printf("%.2f",result); break;

Program to check positive negative or zero using switch case

C
4 years ago
#include<stdio.h> int main (){ int n=-9; switch(n>0){ case 1 : printf("Positive number "); break; case 0: switch(n<0){ case 1:

Logic to find maximum using switch...case statement

C
4 years ago
#include<stdio.h> int main(){ int n=1,n1=5; switch(n>n1){ case 0: printf("Max=%d ",n1); break; case 1: printf("Max=%d",n); break;

to check vowel or consonant using switch case

C
4 years ago
#include<stdio.h> int main(){ char ch='w'; switch(ch){ case 'a': printf("It is a vowel"); break; case 'e': printf("It is a vowel"); break;

Logic to print number of days in month using switch...case

C
4 years ago
#include <stdio.h> int main() { int month=8; switch(month) {

Write a C program to print day of week name using switch c

C
4 years ago
#include<stdio.h> int main (){ int week =3; switch(week){ case 1: printf("Monday"); break; case 2: printf("Tuesday"); break;

Logic to calculate net electricity bill

C
4 years ago
#include <stdio.h> int main() { int unit; float amt, total_amt, sur_charge; unit=150; /* Calculate electricity bill according to given conditions */

C program to enter student marks and find percentage and grade

C
4 years ago
#include <stdio.h> int main() { int unit; float amt, total_amt, sur_charge; unit=150; /* Calculate electricity bill according to given conditions */

C program to enter student marks and find percentage and grade

C
4 years ago
#include<stdio.h> int main(){ int n1=95,n2=95,n3=97,n4=98,n5=90; float per=((n1+n2+n3+n4+n5)/5.0); if(per>=90){ printf("Grade A "); } else if (per>=80){ printf("Grade B "); }

Logic to find profit or loss

C
4 years ago
#include<stdio.h> int main(){ int cp=1000; int sp=1500; int profit=sp-cp; int loss=cp-sp; printf("profit= %d\n",profit); printf("Loss= %d\n",loss); }

Write a C program to input all sides of a triangle and check whether triangle is valid or not.

C
4 years ago
#include<stdio.h> int main(){ int a=7 ,b=4,c=10; if (a+b>c && b+c>a &&c+a>b){ printf("It is a triangle"); } else{ printf("It is not a triangle"); }

C program to check whether triangle is valid or not if angles are given

C
4 years ago
#include<stdio.h> int main(){ int A=60,B=60,C=60; if(A+B+C==180){ printf("It is a triangle"); } else{ printf("It is not a triangle"); } }

Program to count minimum number of denomination for given amount

C
4 years ago
#include <stdio.h> int main() { int amount; int note500, note100, note50, note20, note10, note5, note2, note1; /* Initialize all notes to 0 */ note500 = note100 = note50 = note20 = note10 = note5 = note2 = note1 = 0;

C program to find number of days in month

C
4 years ago
#include<stdio.h> int main(){ int month=12; if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12){ printf("It as 31 days"); } else if(month==2){ printf("It as 29 days"); } else{

Write a C program to input week number and print week day.

C
4 years ago
#include<stdio.h> int main(){ int n=6; if (n==1){ printf("Monday"); } else if (n==2){ printf("Tuesday"); } else if (n==3){

Write a C program to check whether a character is uppercase or lowercase alphabet.

C
4 years ago
#include<stdio.h> int main(){ char ch ; if(ch>='a'&& ch<='z'){ printf("It is a lower case "); } else{ printf("It is a uppper case"); } }