Skip to content

Instantly share code, notes, and snippets.

View sachinsaxena25's full-sized avatar

sachinsaxena25

View GitHub Profile
#include<stdio.h>
int main(void){
float principle = 0.0f;
float time = 0.0f;
float rate = 0.0f;
float si = 0.0f;
printf("please enter the principle amount in :\n");
scanf("%f", &principle);
printf("please enter the time duration in years ex = 4 / 5.5 etc:\n");
scanf("%f", &time);
#include<stdio.h>
int main(void){
float basic_salary = 0.0f;
float hra = 0.0f;
float ta = 0.0f;
printf("please enter your basic salary:\n");
scanf("%f", &basic_salary);
hra = (40.0f / 100.0f) * basic_salary;
ta = (20.0f / 100.0f) * basic_salary;
printf("Basic salary:%.2f\n", basic_salary);
#include<stdio.h>
int main (void)
{
float kilometre = 0.0f;
printf("please enter the value of kilometre:\n");
scanf("%f", &kilometre);
float metre = 0.0f;
float feet = 0.0f;
float centimetre = 0.0f;
metre = kilometre * 1000.0f;
#include<stdio.h>
int main(void){
float fahrenheit = 0.0f;
float celsius = 0.0f;
printf("please enter the value of fahrenheit :\n");
scanf("%f", &fahrenheit);
celsius = (fahrenheit - 32) * 5 / 9;
printf("Fahrenheit To Celsius is = %.2f\n", celsius);
return 0;
}
#include<stdio.h>
int main(void){
int current_year = 0;
int year_of_joining = 0;
float year_of_services = 0.0f;
float bonus = 0.0f;
printf("please enter current year:");
scanf("%d", &current_year);
printf("please enter year of joining:");
scanf("%d", &year_of_joining);
#include<stdio.h>
int main(void){
float principle_amount = 0.0f;
float time = 0.0f;
printf("please enter the principle_amount:\n");
scanf("%f", &principle_amount);
printf("please enter the time duration:\n");
scanf("%f", &time);
if(time > 10.0f)
printf("%.2f", principle_amount * time * 8.0f / 100.0f);
#include<stdio.h>
int main(void){
int a = 0;
int b = 0;
int c = 0;
printf("please enter the value of a:\n");
scanf("%d", &a);
printf("please enter the value of b:\n");
scanf("%d", &b);
printf("please enter the value of c:\n");
#include<stdio.h>
int main(void){
int inputNumber = 0;
printf("please enter number:");
scanf("%d", &inputNumber);
(inputNumber % 2 == 0) ? printf("number is even", inputNumber) : printf("number is odd", inputNumber);
return 0;
}
#include<stdio.h>
int main(void){
int a = 0;
int b = 0;
int c = 0;
printf("please enter the first number: \n");
scanf("%d", &a);
printf("please enter the second number: \n");
scanf("%d", &b);
printf("The numbers before swapping are a = %d b = %d", a, b);
#include<stdio.h>
int main(void){
int x1 = 0;
int x2 = 0;
printf("please enter the first number:\n");
scanf("%d", &x1);
printf("please enter the second number:\n");
scanf("%d", &x2);
printf("The numbers before swapping are x1 = %d x2 = %d", x1, x2);
x1 = x1 + x2;