Tuesday, May 2, 2017

Return Type Funtion without passing any Argument.

#include<stdio.h>
#include<conio.h>
int sum();

main()
{
int x;
x=sum();
printf("Sum= %d",x);
getch();
}
int sum(int x,int y)
{
int a , b;
printf("Enter two numbers");
scanf("%d %d",&a,&b);
int sum;
sum=x+y;
return sum;
}

WAP to write "Welcome To Geomatics Engineering" on a file 'test.txt'.

#include<stdio.h>
#include<conio.h>
main()
{
    FILE *fp;
    fp=fopen("test.txt","w");
    if(fp==NULL)
    {
        printf("FILE CAN NOT BE CREATED");
        exit(1);
    }
    else
    {
        printf("FILES SUCCESSFULLY CREATED");
       
    }
    fputs("Welcome To Geomatics Engineering",fp);
    fclose(fp);
    getch();
}

Hello World

Hello World is a first program written on any Programming Language. It just displays a text "Hello Word" on output screen.

#include<stdio.h>
#include<conio.h>
void main()
{
printf("Hello World");
getch();
}


Return Type Funtion without passing any Argument.

#include<stdio.h> #include<conio.h> int sum(); main() { int x; x=sum(); printf("Sum= %d",x); getch(); } int sum(int x...