C programming codes #1

C language programs

In this blog we are going to add some of the common and easy C program code.

1. Program to print hello world!!.

As we know print is one of the easy and common program.

and here we go with the programming code


a) Using only stdio.h library


#include<stdio.h>

int main() {

    printf("hello world!!");

    return 0;


b) using stdio.h and conio.h library

#include<stdio.h>

#include<conio.h>

void main(){

    clrscr();

    printf("hello world!!");

    getch();

}


so, it was the first code and now we gonna add second code




2) Program to assign values of two numbers and print their addition.

Now this program also include a lot of methods but somehow we are writing are two of the method.



a) Using only stdio.h library

#include <stdio.h>

int main() {

    int a = 10, b = 10;

    printf("%d",a+b);

    return 0;   

}


b) Using stdio.h and conio.h libraries.


#inlcude<stdio.h>

#include<conio.h>

void main() {

    int a = 10, b = 10;

    clrscr();

    int ans = a + b;

    printf("%d",a+b);

    getch();

}




thats it if you liked the post let us know in the comments and do share it with you friends.


Previous
Next Post »

1 comments:

Click here for comments
Unknown
admin
January 10, 2021 at 5:54 AM ×

Bdiya bhai

Congrats bro Unknown you got PERTAMAX...! hehehehe...
Reply
avatar