Академический Документы
Профессиональный Документы
Культура Документы
int main(void)
// declare variables
int a;
float b;
char c;
return 0;
#include <stdio.h>
int main()
printf("Hello World!");
return 0;
#include<stdio.h>
int main()
int a,b,sub;
//Read value of a
scanf("%d",&a);
//Read value of b
scanf("%d",&b);
//formula of subtraction
sub= a-b;
return 0;
#include <stdio.h>
int main()
int a,b,sum;
float avg;
scanf("%d",&a);
scanf("%d",&b);
sum=a+b;
avg= (float)(a+b)/2;
return 0;
#include <stdio.h>
int main()
char ch;
//input character
scanf("%c",&ch);
printf("ASCII is = %d\n", ch);
return 0;
#include <stdio.h>
int main()
scanf("%d",÷nd);
scanf("%d",&divisor);
quotient= dividend/divisor;
remainder= dividend%divisor;
#include <stdio.h>
int main()
float amount,rate,time,si;
scanf("%f",&amount);
scanf("%f",&rate);
scanf("%f",&time);
si=(amount*rate*time)/100;
return 0;
}
C program to read marks and print total and percentage
#include<stdio.h>
int main()
int science;
int math;
int english;
int total;
float per;
science = 50;
math = 90;
english = 40;
//calculating total
//calculating percentage
return 0;
#include <stdio.h>
int main()
char name[30];
gets(name);
scanf("%f",&basic);
scanf("%f",&hra);
scanf("%f",&da);
pf= (basic*12)/100;
gross=basic+da+hra+pf;
return 0;
#include <stdio.h>
int main()
char a ='A';
int b =120;
float c =123.0f;
double d =1222.90;
printf("\nSize of a: %d",sizeof(a));
printf("\nSize of b: %d",sizeof(b));
printf("\nSize of c: %d",sizeof(c));
printf("\nSize of d: %d",sizeof(d));
#include <stdio.h>
int main()
printf("Hello\nWorld!"); //use of \n
printf("\nHello\tWorld!"); // use of \t
printf("\nHello\bWorld!"); //use of \b
return 0;
#include <stdio.h>
#define PI 3.14f
int main()
{
scanf("%f",&rad);
area=PI*rad*rad;
perm=2*PI*rad;
return 0;
#include <stdio.h>
int main()
float l,b,area;
scanf("%f",&l);
scanf("%f",&b);
area=l*b;
return 0;
#include<stdio.h>
int main()
int feet,inches;
scanf("%d",&feet);
inches=feet*12;
return 0;
int main(){
char ch;
int asciiValue;
scanf("%c",&ch);
asciiValue=(int)ch;
#include <stdio.h>
//main program
int main()
float pf,it;
float net_salary;
//input required fields
scanf("%f",&basic);
scanf("%f",&hra);
scanf("%f",&ta);
scanf("%f",&others);
da = (basic*12)/100;
pf = (basic*14)/100;
it = (basic*15)/100;
return 0;
}
Program to swap numbers without using temporary variable in C
#include <stdio.h>
int main()
//variable declarations
int a,b;
//Input values
scanf("%d",&a);
scanf("%d",&b);
//swapping numbers
a = a+b;//step 1
b = a-b; //step 2
a = a-b; //step 3
#include <stdio.h>
int main(void) {
int n, sum;
//input value of n
scanf("%d", &n);
sum =0;
sum = n*(n+1)/2;
//print sum
return 0;