Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute C Online

c

#include <stdio.h>
//
int main()
{
    printf("Hello, World!\n");

    return 0;
}

Compile and Execute C Online

c

#include <stdio.h>

int main()
{
    printf("Hello, World!\n");

    return 0;
}

Compile and Execute C Online

c

#include <stdio.h>

int n=2;
void main()
{
    
    printf(" enter a positive number");
    scanf("%d",&n );
    
    if ((n%2)==0)
    {
        printf("the number is even");
    }
    else 
    {
        printf("the number is odd");
    }
    
    

    
}

Halloum

c

#include <stdio.h>

int main()
{
    printf("Hello, World!\n");

    return 0;
}

Question 3

c

// To convert switch statement into if statement.
#include <stdio.h>
    int main(void) {
    int score;
    char grade;
    
    printf("Enter score: ");
    scanf("%d", &score);
    
    switch (score) {
        case 10: printf("case 10\n");
        case 9: printf("case 9\n");
        case 8: grade = 'A'; break;
        case 7: printf("case 7\n");
        case 6: grade = 'B'; break;
        case 5: grade = 'C'; break;
        default: grade = 'F';
    }
    
    printf("Grade is %c.\n", grade);
    return 0;
}

1111

c

#include <stdio.h>

int main()
{
    printf("Hello, World!\n");
    int a;
    scanf("a, &c");
    printf(a);
    return 0;
}

sam2

c

#include <stdio.h>

int main( int argc, char *argv[] )  {

   if( argc == 2 ) {
      printf("The argument supplied is %s\n", argv[1]);
   }
   else if( argc > 2 ) {
      printf("Too many arguments supplied.\n");
   }
   else {
      printf("One argument expected.\n");
   }
}

sodiholhgs

c

#include <stdio.h>

int main()
{
    printf("Hello!\n");

    return 0;
}

balaram

c

#include <stdio.h>
void main() 
{
	char c=125;
	c=c+10;
	printf("%d",c);
	return 0;
}

child2replacement

c

#include <stdio.h>

#include <string.h>

#include <unistd.h>



int main()

{

	int PID;

	int childnum;



	for(childnum=1; childnum<=3; childnum++)

	{

		PID=fork();



		if (PID>0)

		{

			printf("Parent, my pid is %d: Spawned child #%d whose pid is %d\n", getpid(), childnum, PID);

		}



		else

		{

			printf("I am child #%d, my pid is %d; my parent's pid is %d\n", childnum, getpid(), getppid());



			if (childnum==2)

				execv("child2replacement",NULL);



			childnum=10;

		}	

	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.