C Programs (Basics) For Beginners
C Programs (Basics) For Beginners
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a>0){
else if(a<0){
else{
Output:
int main(){
int a;
scanf("%d",&a);
int c = a%2;
if(c==0){
printf("The number is even");
else{
Output:
3.) Input the day of a week and print holiday or working day.
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
if(a!=7 or a !=1){
else{
printf("It is holiday");
Output:
4.) Input any number and check whether the given no is divisible by 3 and 7
or not.
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d",&a);
b = a%3;
c= a%7;
else{
Output:
5.) Input three numbers and display the smallest one.
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d,%d,%d",&a,&b,&c);
printf("%d is smallest",a);
printf("%d is smallest",b);
else{
printf("%d is smallest",c);
Output:
int main(){
int a,b,c;
printf("Enter 3 angles of a triangle : ");
scanf("%d,%d,%d",&a,&b,&c);
if(a==b&&b==c){
printf("It is equilateral");
printf("It is isoceles");
else{
printf("It is scalene");
Output:
7.) Input the sides of triangle and decide if it is right angled, obtuse or acute.
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d,%d,%d",&a,&b,&c);
}
else{
Output:
8.) Input any three numbers and display the middle number.
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d,%d,%d",&a,&b,&c);
else{
Output:
9.) Program to display the area of rectangle, circle, triangle using else if
ladder.
#include<stdio.h>
int main(){
int o,r,l,b,h;
printf("1.)Circle\n2.)Rectangle\n3.)Triangle\n");
scanf("%d",&o);
if(o==1){
scanf("%d",&r);
else if(o==2){
scanf("%d,%d",&l,&b);
else{
scanf("%d,%d",&b,&h);
}
Output :
10.) Write a c program to test whether a candidate is eligible for job or not.
#include<stdio.h>
int main(){
int a,b;
scanf("%d",&a);
printf("Do you have intermediate degree and minimum 5 years’ experience.?\n 1.)Yes\n2.)No \n");
scanf("%d",&b);
if(a==1 || b==1){
else{
Output: