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

rwr ew rtweqr wer weqr wwerq qwe

c

#include <stdio.h>
#include <math.h>

int main()
{
    float a, b, c, S, p;
    
    printf("Please enter a:");
    scanf("%d", &a);

    printf("Please enter b:");
    scanf("%d", &b);
    
    printf("Please enter c:");
    scanf("%d", &c);
    
    p = (a+b+c)/2;
    
    S = sqrt(p*(p-a)*(p-b)*(p-c));
    
    printf("The area of triangle: %d", &S);
    
    return 0;
}

afwqoijeioqwjeiqwojrqwpjrpqwjropqwkroqw

c

#include <stdio.h>
#include <math.h>

int main()
{
    float a, b, c, S, p;
    
    printf("Please enter a:");
    scanf("%d", &a);

    printf("Please enter b:");
    scanf("%d", &b);
    
    printf("Please enter c:");
    scanf("%d", &c);
    
    p = (a+b+c)/2;
    
    S = sqrt(p*(p-a)*(p-b)*(p-c));
    
    printf("The area of triangle: %d", &S);
    
    return 0;
}

pppppppppppppppppppppppppppppppppppppppppppp

c

#include <stdio.h>

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

    return 0;
}

Compile and Execute C Online

c

#include <stdio.h>

#define GET_BYTE(_N, _B) ((_N) >> ((_B) << 3))
#define XORSWAP(a, b)   ((&(a) == &(b)) ? (a) : ((a)^=(b),(b)^=(a),(a)^=(b)))

int main()
{
    int x = 12345678;
    int k;
    for(k = 0; k < sizeof(x); k+=2) {
        XORSWAP(((char *)&x)[k], ((char *)&x)[k+1]);
    }
    printf("swapped: %lx", x);
    return 0;
}

Compile and Execute C Online

c

#include <stdio.h>

char fakeInput[]="blablafz";

char* removeDuplicate(char str[]);

int main()
{
    //printf("Hello, World!\n");
    
    printf("RESULT: %s \n", removeDuplicate(fakeInput) );
    
    return 0;
}

char* removeDuplicate(char input[]) {
int i = 0;

// temps
int repIndex = 0;
int temp     = 0;

// crveni kvadratic
int j        = 0;
char ch;

printf("Input: %s\n",input);

while((ch = input[i++] ) != '\0') // jel trenutni element eol?
{
    
    j = i; // prije smo i++ inkrementirali, j = i da j ne gleda sam sebe
    
    printf("Looking for %c \n",ch);
    
    while(input[j] != '\0') // to je vec sljedeci element.. jel element 1 eol?
    {
        printf("Checking if %c = %c \n",input[j],ch);
        repIndex = j;
        if(ch == input[repIndex]) // b= l?n b=a?n b=b?y
        {
            printf("Yup\n");
            while(input[repIndex]!='\0')
            {
                printf("Removing %c \n",input[j]);
                temp = repIndex;
                input[temp] = input[++repIndex];
    
            }
    
        } else {
            printf("Next letter.. \n");
            j++; 
            }
    
    }
}

return input;
}

Computer Science Average Exan Calculator

c

#include <iostream>
using namespace std;

int main()
{
    int n, i;
    float num[100], sum = 0.0, average;

    cout << "Enter the numbers of data: ";
    cin >> n;

    while (n > 100 || n <= 0)
    {
        cout << "Error! number should in range of (1 to 100)." << endl;
        cout << "Enter the number again: ";
        cin >> n;
    }

    for (i = 0; i < n; ++i)
    {
        cout << i + 1 << ". Enter number: ";
        cin >> num[i];
        sum += num[i];
    }

    average = sum / n;
    cout << "Average = " << average;

    return 0;
}
}

manish kumar verma mnnit allahabad

c

#include<stdio.h>
float salary(int,int);
int main()
{
	float sal;
	int i,n,hr,pr;
	char name[n];
	printf("How many letters in your name (with space) :-\n");
	scanf("%d",&n);
	printf("Enter your name:-");
	for(int i=0;i<n;i++)
	scanf("%c",&name[i]);
	printf("Enter your working hours:");
	scanf("%f",&hr);
	printf("Enter pay rate:");
	scanf("%f",&pr);
	sal=salary(hr,pr);
	for(int i=0;i<n;i++)
	printf("%c",name[i]);
	printf("\nHour:%fPayrate:%fSalary:%f",hr,pr,sal);
}
float salary(int hr,int pr)
{
	return hr*pr;
}

Compile and Execute C Online

c

#include <stdio.h>

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

    return 0;
}

palindromeproject12345678

c

#include <stdio.h>

int main()
{
    int a;
    int b;
    int rev=0;
    int temp = a;
    while (a>0)
    {
        b=a%10;
        rev=rev*10+b;
        a=a/10;
    }
   // printf("%d \n",rev);
    //printf("%d",temp);
    {
        if (temp==rev)
    {
        printf("palindrome");
    }
    else 
    {
        printf("no");
    }
    }
}

Compile and Execute C Online

c

#include <stdio.h>
char findMSB(int number)
{
    char msb = 0;
    int sizeInBits = 0;
    sizeInBits = sizeof(number)*8;
    
    for(char iii =0;iii<sizeInBits;iii++)
    {
        ((number>>iii)&1)?(msb = iii):NULL; 
    }
    printf("msb is %d\n",msb);
    return msb;
}

char ifAlternate(char msb,int number)
{
    char lsb = 0,isAlternate = 1;
    (number&1)?(lsb = 1):(lsb=0);
    char valueOfBit = 0;
    for(char iii = 0;iii<=msb;iii++)
    {
        
        valueOfBit = (number>>iii)&1;
        printf("\nvalueof bit is %d\n",valueOfBit);
        if((iii%2 == 0)&&(valueOfBit==lsb))
            continue;
        else if((iii%2 != 0)&&(valueOfBit!=lsb))
            continue;
        else 
        {
            isAlternate = 0;
            break;
        }   
    }
    (isAlternate == 1)?printf("\nis alternate\n"):printf("\ni not alternate\n");
    return isAlternate;
}
int main()
{
     int number;
     char msb = 0,isAlternate =0;
     scanf("%d",&number);
     msb = findMSB(number);
     isAlternate = ifAlternate (msb,number); 
    return 0;
}

Advertisements
Loading...

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