K

@karthikeyasharma000

Logic to check alphabet, digit or special character

C
4 years ago
#include<stdio.h> int main(){ char ch='5'; if((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')){ printf("It is a alphabet"); } else if (ch>='0' && ch<='9'){ printf("It is a digit "); } else {

C program to check vowel or consonant

C
4 years ago
#include<stdio.h> int main(){ char ch='t'; scanf("%c",&ch); if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'){ printf("It is a vowel letter "); } else{ printf("It is a consonant"); }

Write a C program to check whether a number is divisible by 5 and 11 or not.

C
4 years ago
#include<stdio.h> int main(){ int n=55; if(n%5==0 && n%11==0){ printf("It is divisible by 5 and 11"); } else{ printf("It is not divisible by 5 and 11 "); } }

Write a C program to check whether a number is negative, positive or zero.

C
4 years ago
#include<stdio.h> int main(){ int n=1; if(n>0){ printf("Postive number "); } else if (n<0){ printf("Negative number ");

C program to check alphabets using Conditional operator

C
4 years ago
/** * C program to check alphabets using Conditional operator */ #include <stdio.h> int main() { char ch;

C program to check leap year using Conditional operator

C
4 years ago
#include<stdio.h> int main(){ int n=1900; if(n%4==0 && n%100!=0){ printf("leap year "); } else if (n%400==0 && n%100 == 0){ printf("leap year"); } else{

c program to check even or odd number using conditional operator

C
4 years ago
#include<stdio.h> int main(){ int n=10; if(n%2==0){ printf("Even"); } else { printf("Odd"); }

C program to find maximum between three numbers using conditional operator

C
4 years ago
#include<stdio.h> int main(){ int a=30,b=54,c=84; if(a>b && a>c){ printf("%d",a); } else if (b>c){ printf("%d",b); } else{

Write a C program to find maximum between two numbers using conditional operator

C
4 years ago
#include<stdio.h> int main () { int a,b,max=0 ; a=10; b=70; if (a>b){ max=a; printf("Maximum number=%d",max); }

C program to calculate Compound Interest

C
4 years ago
#include <stdio.h> #include <math.h> int main() { float principle=1200, rate=2, time=5.4 , CI; /* Calculate compound interest */ CI = principle* (pow((1 + rate / 100), time));

C program to calculate Simple Interest

C
4 years ago
#include <stdio.h> int main() { float principle=1200, time=2, rate=5.4 , SI; /* Calculate simple interest */ SI = (principle * time * rate) / 100;

C program to calculate total average and percentage of five subjects

C
4 years ago
#include<stdio.h> int main(){ int s1=95; int s2=76 ; int s3=85; int s4=90; int s5=89; int total =s1+s2+s3+s4+s5; float avg =(s1+s2+s3+s4+s5)/5; float per =avg/10;

Write a C program to calculate area of an equilateral triangle.

C
4 years ago
#include<stdio.h> #include<math.h> int main(){ int s=10; float area=sqrt(3)/4*s*s; printf(" area of equilateral triangle = %f",area);

C program to find area of a triangle

C
4 years ago
#include<stdio.h> int main(){ int b=4,h=6; float area=0.5*b*h; printf("Area of triangle = %.2f",area); }

C program to find angles of triangle if two angles are given

C
4 years ago
#include<stdio.h> int main(){ int A=60,B=60; int C=180-(A+B); printf("Third angle = %d",C); }

C program to find square root of a number

C
4 years ago
#include<stdio.h> #include<math.h> int main(){ int num=4; int squart =sqrt(num); printf("Squart of %d = %d",num,squart); }

C program to find power of a number using pow function

C
4 years ago
#include<stdio.h> #include<math.h> int main(){ int x=2,y=3; int power= pow(x,y); printf("Power of %d and %d=%d",x,y,power); }

Write a C program to enter temperature in Celsius and convert it into Fahrenheit.

C
4 years ago
#include<stdio.h> int main(){ int celsius =100; printf("Celsius=%d\n",celsius); float fahrenheit=(celsius*9/5)+32; printf("Fahrenheit= %.2f\n",fahrenheit); }

Write a C program to enter length in centimeter and convert it into meter and kilometer

C
4 years ago
#include <stdio.h> int main() { float cm=1000, meter, km; /* Input length in centimeter from user */ printf("Enter length in centimeter:\n "); scanf("%f", &cm);

Write a C program to enter radius of a circle and find its diameter, circumference and area

C
4 years ago
#include<stdio.h> int main(){ int rad=4; int dia=2*rad; float circ=2*3.14*rad; float area=3.14*rad*rad; printf("Diameter=%d\n",dia); printf("Circumference=%.2f\n",circ); printf("Area=%.2f\n",area); }