Dev-C++


What is Dev-C++?



Dev-C++, developed by Bloodshed Software, is a fully featured graphical IDE (Integrated Development Environment), which is able to create Windows or console-based C/C++ programs using the MinGW compiler system. MinGW (Minimalist GNU* for Windows) uses GCC (the GNU g++ compiler collection), which is essentially the same compiler system that is in Cygwin (the unix environment program for Windows) and most versions of Linux. There are, however, differences between Cygwin and MinGW; link to Differences between Cygwin and MinGW for more information.











No : 1 Open Dev C++








No : 2 press control N (cont +N )




No : Make a Codes





Dev C++ coding

CODEING NO:  1  


Make a calculator only Plus

First you copy the code and paste it on Dev C++

 #include <stdio.h>  
 int main()  
 { int a,b,sum;  
 printf("Enter an integer:");  
 scanf("%d%d",&a,&b);  
 sum=a+b;  
 printf("The Sum of two number is %d",sum);  
 return 0;  
 }  

EXAMPLE
 Enter an integer: 8 Enter an integer : 547896  
 9548773  
 The Sum of two number is 17 The sum of two number is 1096669  

-------------------------------- -------------------------------- --------------------------------

CODEING NO:  2

MAKE A ODD AND EVEN CODE

First you copy the code and paste it on Dev C++
 #include <stdio.h>  
 int main() {  
 int num;  
 printf("Enter an integer: ");  
 scanf("%d", &num);  
 // true if num is perfectly divisible by 2  
 if(num % 2 == 0)  
 printf("%d is even.", num);  
 else  
 printf("%d is odd.", num);  
 return 0;  
 }  

EXAMPLE
 Enter an integer: 8 Enter an integer: 2  
 8 is even. 2 is odd  

-------------------------------- -------------------------------- --------------------------------

CODEING NO:  3

Make a largest code

First you copy the code and paste it on Dev C++

 #include <stdio.h>  
 int main() {  
 int n1, n2, n3;  
 printf("Enter three different numbers: ");  
 scanf("%d %d %d", &n1, &n2, &n3);  
 // if n1 is greater than both n2 and n3, n1 is the largest  
 if (n1 >= n2 && n1 >= n3)  
 printf("%d is the largest number.", n1);  
 // if n2 is greater than both n1 and n3, n2 is the largest  
 if (n2 >= n1 && n2 >= n3)  
 printf("%d is the largest number.", n2);  
 // if n3 is greater than both n1 and n2, n3 is the largest  
 if (n3 >= n1 && n3 >= n2)  
 printf("%d is the largest number.", n3);  
 return 0;  
 }  

EXAMPLE

 Enter three different numbers: 5  
 8  
 6  
 8 is the largest number.  
 -------------------------------- -------------------------------- --------------------------------


CODEING NO:  4


Make a bytes in code

Program to Find the Size of Variables

First you copy the code and paste it on Dev C++


 #include<stdio.h>  
 int main() {  
 int intType;  
 float floatType;  
 double doubleType;  
 char charType;  
 // sizeof evaluates the size of a variable  
 printf("Size of int: %zu bytes\n", sizeof(intType));  
 printf("Size of float: %zu bytes\n", sizeof(floatType));  
 printf("Size of double: %zu bytes\n", sizeof(doubleType));  
 printf("Size of char: %zu byte\n", sizeof(charType));  
 return 0;  
 }  

EXAMPLE
 Size of int: 4 bytes  
 Size of float: 4 bytes  
 Size of double: 8 bytes   
 Size of char: 1 byte  
 -------------------------------- -------------------------------- --------------------------------


CODEING NO:  5

Simple Calculator using switch Statement

First you copy the code and paste it on Dev C++

 #include <stdio.h>  
 int main() {  
   char o;  
   double first, second;  
   printf("Enter an o (+, -, *,): ");  
   scanf("%c", &o);  
   printf("Enter two o: ");  
   scanf("%lf %lf", &first, &second);  
   switch (o) {  
   case '+':  
     printf("%.1lf + %.1lf = %.1lf", first, second, first + second);  
     break;  
   case '-':  
     printf("%.1lf - %.1lf = %.1lf", first, second, first - second);  
     break;  
   case '*':  
     printf("%.1lf * %.1lf = %.1lf", first, second, first * second);  
     break;  
   case '/':  
     printf("%.1lf / %.1lf = %.1lf", first, second, first / second);  
     break;  
     // operator doesn't match any case constant  
   default:  
     printf("Error! operator is not correct");  
   }  
   return 0;  
 }  

EXAMPLE

 Enter an c (+, -, *,): +  
 Enter two operands: 5  
 2  
 5.0 + 2.0 = 7.0  

 -------------------------------- -------------------------------- --------------------------------

CODEING NO:  6

Swap Numbers Using Temporary Variable

First you copy the code and paste it on Dev C++

#include<stdio.h>

int main() {

      double first, second, temp;

      printf("Enter first number: ");

      scanf("%lf", &first);

      printf("Enter second number: ");

      scanf("%lf", &second);


      // Value of first is assigned to temp

      temp = first;


      // Value of second is assigned to first

      first = second;


      // Value of temp (initial value of first) is assigned to second

      second = temp;


      // %.2lf displays number up to 2 decimal points

      printf("\nAfter swapping, firstNumber = %.2lf\n", first);

      printf("After swapping, secondNumber = %.2lf", second);

      return 0;

}

EXAMPLE

Enter first number: 5

Enter second number: 9


After swapping, firstNumber = 9.00

After swapping, secondNumber = 5.00

 -------------------------------- -------------------------------- --------------------------------

CODEING NO:  7

Using if Statement

First you copy the code and paste it on Dev C++

#include <stdio.h>

int main() {

    double n1, n2, n3;

    printf("Enter three different numbers: ");

    scanf("%lf %lf %lf", &n1, &n2, &n3);


    // if n1 is greater than both n2 and n3, n1 is the largest

    if (n1 >= n2 && n1 >= n3)

        printf("%.2f is the largest number.", n1);


    // if n2 is greater than both n1 and n3, n2 is the largest

    if (n2 >= n1 && n2 >= n3)

        printf("%.2f is the largest number.", n2);


    // if n3 is greater than both n1 and n2, n3 is the largest

    if (n3 >= n1 && n3 >= n2)

        printf("%.2f is the largest number.", n3);


    return 0;

}

EXAMPLE

Enter three different numbers: 10

50

5

50.00 is the largest number.

 -------------------------------- -------------------------------- --------------------------------

CODEING NO:  8

Program to Check Vowel or consonant

First you copy the code and paste it on Dev C++

#include <stdio.h>

int main() {

    char c;

    int lowercase_vowel, uppercase_vowel;

    printf("Enter an alphabet: ");

    scanf("%c", &c);


    // evaluates to 1 if variable c is a lowercase vowel

    lowercase_vowel = (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u');


    // evaluates to 1 if variable c is a uppercase vowel

    uppercase_vowel = (c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');


    // evaluates to 1 (true) if c is a vowel

    if (lowercase_vowel || uppercase_vowel)

        printf("%c is a vowel.", c);

    else

        printf("%c is a consonant.", c);

    return 0;

}

EXAMPLE                                        

Enter an alphabet: A                          Enter an alphabet: B

A is a vowel.                                      B is a consonant.

 -------------------------------- -------------------------------- --------------------------------

CODEING NO:  9

Program to Check Leap Year

First you copy the code and paste it on Dev C++

#include <stdio.h>

int main() {

   int year;

   printf("Enter a year: ");

   scanf("%d", &year);


   // leap year if perfectly divisible by 400

   if (year % 400 == 0) {

      printf("%d is a leap year.", year);

   }

   // not a leap year if divisible by 100

   // but not divisible by 400

   else if (year % 100 == 0) {

      printf("%d is not a leap year.", year);

   }

   // leap year if not divisible by 100

   // but divisible by 4

   else if (year % 4 == 0) {

      printf("%d is a leap year.", year);

   }

   // all other years are not leap years

   else {

      printf("%d is not a leap year.", year);

   }


   return 0;

}

EXAMPLE  

Enter a year: 2021                                Enter a year: 2016

2021 is not a leap year.                        2016 is a leap year.

 -------------------------------- -------------------------------- --------------------------------

CODEING NO:  10

First you copy the code and paste it on Dev C++

#include <stdio.h>
int main() {
    double n1, n2, n3;
    printf("Enter three different numbers: ");
    scanf("%lf %lf %lf", &n1, &n2, &n3);

    // if n1 is greater than both n2 and n3, n1 is the largest
    if (n1 >= n2 && n1 >= n3)
        printf("%.2f is the largest number.", n1);

    // if n2 is greater than both n1 and n3, n2 is the largest
    if (n2 >= n1 && n2 >= n3)
        printf("%.2f is the largest number.", n2);

    // if n3 is greater than both n1 and n2, n3 is the largest
    if (n3 >= n1 && n3 >= n2)
        printf("%.2f is the largest number.", n3);

    return 0;
}

EXAMPLE

Enter three different numbers: 5
9
4
9.00 is the largest number.

 -------------------------------- -------------------------------- --------------------------------
CODEING NO:  11
First you copy the code and paste it on Dev C++

#include <stdio.h>
int main() {
    double num;
    printf("Enter a number: ");
    scanf("%lf", &num);
    if (num <= 0.0) {
        if (num == 0.0)
            printf("You entered 0.");
        else
            printf("You entered a negative number.");
    } else
        printf("You entered a positive number.");
    return 0;
}

EXAMPLE

Enter a number: 5
You entered a positive number.

 -------------------------------- -------------------------------- --------------------------------

Thank you for Visit

 





Post a Comment

Previous Post Next Post