C PROGRAM WITH RETURN TYPE

Integer return type

1. #include<stdio.h>

2.    int main()

3.    {

4.    printf(“hello my first program”);

5.    return 1;

6.    }    

Void return type with more than one print f method 

#include<stdio.h>

void main()

{

  printf(“hello my first program”)

  printf(“vikas”);

  printf(“Rahul”);

  printf(“Neeraj”);

  printf(“shyam”);

}

Points to note

·       C is a case sensitive programming language.

·       Every code inside body should start after giving a tab.

 

“\n”:it is used to print the written after using this tag in new line.

#include<stdio.h>

void main()

{

  printf(“my name is \n lokesh”);

  printf(“agarwal”);

}

Output:   my name is                 

lokeshagarwal

“\t”:this is provide a tab space b/w the words we used.

 

Write above code using “\t”

#include <stdio.h>

void main()

{

  printf(“my name is \t Lokesh/t”);

  printf(“agarwal”);

}

Output:   my name is           Lokesh agarwal

Wap to print addition of two no’s

#include <stdio.h>

#include <conio.h>

void main()

{

  int a,b,c;

  clrscr();

  printf(“enter two no”);

  scanf(“%d%d”, &a, &b);

  c=a+b;

  printf(“addition of %d and %d=%d”);

  scanf(“%d%d”,&a,&b,&c);

  getch();

}