Skip to content

Prabhanjan2007/Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Module 1

day 1

Write a C program to initialize the value as 5.800000 & display the same value as 5.8.

program

#include <stdio.h>
int main()
{
    float a=5.800000;
    printf("%.1f",a);
    return 0;
}

output

image

day 2

Write a C program to read N value and check that value is equal to 10 or not using if-else

program

#include<stdio.h>
int main()
{
    int N;
    scanf("%d",&N);
    if(N!=10)
    {
        printf("Given number is NOT TEN.");
    }
    else
    {
        printf("Given number is TEN.");
    }
    return 0;
}

output

image

day 3

Write a C program to calculate the diameter and circumference of circle.

program

#include <stdio.h>
int main()
{
    float a;
    scanf("%f",&a);
    printf("Diameter of circle=%.2f units\nCircumference of circle=%.2f units",2*a,2*3.14*a);
    return 0;
}

output

image

day 4

Raju and Ramu purchased a product and they made a self analysis that if cost price and selling price of a product are input through the keyboard,Help them out to write a C program to determine whether the seller has made profit or incurred loss using IF-ELSE.

program

#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d\n%d",&a,&b);
    if((b-a)>0)
    {
        printf("Profit = %d",b-a);
    }
    else
    {
        printf("Loss = %d",a-b);
    }
    return 0;
}

output

image

day 4

Write a C program to check whether number is even number and divisible by 3 or not using nested if.

program

#include<stdio.h>
int main()
{
    int a;
    scanf("%d",&a);
    if(a%2==0)
    {
        printf("The number is even\n");
        if(a%3==0)
        {
            printf("The number is divisible by %d",3);
        }
        else
        {
            printf("The number Not divisible by %d",3);
        }
    }
    else
    {
        printf("The number is NOT an even number");
    }
    return 0;
    
}

output

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published