Posts

Showing posts with the label c programming

MinGW: Installation in 2022

Image
  Hello everyone, today we will install the MinGW installer and compiler in the perfect way so you can run your C or C++ code quickly without any errors. Before I have already discussed a MinGW compilation problem and many people found that very useful, you must check this if you have the same problem  Access-denied-in-vs-code-for-gcc So let's start, there are two things we have to understand, first there is a MinGW installer and a MinGW compiler. First, install the MinGW installer from this link:  MinGW-Installer After downloading click on the installer and it looks like this After installation, we have to install compilers, so follow the below images : As you will land on this page, now select only the selected ones in the image, and on the top-left, you can see an installation button, click on it and install these packages. Now we have to set the path for the MinGW so that our IDE and PC can recognize the compiler. Follow these steps :  File Manager > Windows(...

Patterns in Cpp/ C ( Mixex: Numbers, Stars, Numbers)

Image
  Print this star pattern: Code: If you guys have any questions regarding the solution then comment down your quaries.

Print Reverse Star Pattern Using For Loops

Image
  Answer: #include <stdio.h> int   main () {    int   n ;      scanf ( " %d " , & n );      for  ( int   i  =  0 ;  i  <=  n - 1 ;  i ++)     {          for  ( int   j  =  0 ;  j  <=  n - i - 1 ;  j ++)         {             printf ( "* " );         }          printf ( " \n " );     }           return   0 ; } Now just enter the number of rows you want to print and check the result. Thank you

Print Star Patterns Using For Loops in C language

Image
  Answer: #include <stdio.h> int   main () {    int   n ;      scanf ( " %d " , & n );      for  ( int   i  =  0 ;  i  <  n ;  i ++)     {          for  ( int   j  =  0 ;  j  <=  i ;  j ++)         {             printf ( "* " );         }          printf ( " \n " );     }           return   0 ; }

Print 1 To N Numbers Omiting The Integers Which Are Divisible By 7 Using Loops

Image
  Answer: #include <stdio.h> int   main () {    int   n ;      scanf ( " %d " , & n );      for  ( int   i  =  1 ;  i  <=  n ;  i ++)     {          if ( i % 7  ==  0 ){              continue ;         }  else {              printf ( " %d \n " ,  i );         }     }           return   0 ; }

Calculate First 10 Integer Numbers Sum Using Loops

Image
  Answer: #include <stdio.h> int   main () {    int   n = 10 , sum = 0 , i = 1 ;      while ( i <= n ){          sum  +=  i  ;         ++ i ;     }      printf ( " %d " ,  sum );           return   0 ; } Now just submit the code and check the result.

Find Factorial Of N Positive Number In C language(Loops)

Image
  Write a C program to find factorial of given positive number: Answer: #include   <stdio.h> int   main () {     int   n ;     int   factorial  =  1 ;     scanf ( " %d " , & n );     for  ( int   i  =  n ;  i  >=  1 ;  i --)    {        factorial   =  factorial  *  i  ;    }     printf ( " %d " ,  factorial );         return   0 ; } Now just enter the number and check the result. Thank you

HackerRank 30 Days Of Code Challenge, Day13(Ques 14 in Java)

Image
Objective Today, we will extend what we learned yesterday about  Inheritance  to  Abstract Classes . Because this is a very specific object oriented concept, submissions are limited to the few languages that use this construct. Check out the  Tutorial  tab for learning materials and an instructional video. Task Given a  Book  class and a  Solution  class, write a  MyBook  class that does the following: Inherits from  Book Has a parameterized constructor taking these   parameters: string  string  int  Implements the  Book  class' abstract  display()  method so it prints these   lines: , a space, and then the current instance's  . , a space, and then the current instance's  . , a space, and then the current instance's  . Note:  Because these classes are being written in the same file, you must not use an access modifier (e.g.:  ) when declaring  ...