Tags » C Program

C program to reverse a given number

This c program reverse a number given by user.


// C program to reverse a given number
//Author:Sani kamal
//date: 24-08-2017

#include<stdio.h>

int main(){
int num,a ,rev=0;
printf("Enter any integer:\n");
scanf("%d",&num);
while(num>=1){
a=num%10;
rev=rev*10+a;
num=num/10;

}
printf("Reverse:%d",rev);

&nbsp;

return 0;

}

… 21 more words
Pratice Problem

C program to show swap of two number without using third variables

This c program show swap of two number without using third variables.


// C program to show swap of two number without using third variables
//Author:Sani kamal
//date: 24-08-2017

#include<stdio.h>

int main(){
int num1,num2;
printf("Enter the value for num1 and num2:\n");
scanf("%d%d",&num1,&num2);
num1=num1+num2;
num2=num1-num2;
num1=num1-num2;
printf("After swapping the value of num1 and num2:%d %d",num1,num2);

&nbsp;

return 0;

}

… 38 more words
Pratice Problem

C program to convert temperature degree centigrade to fahrenheit

This C program convert temperature centigrade  to fahrenheit scale.


// C program to convert temperature centigrade to fahrenheit
//Author: Sani Kamal

#include<stdio.h>

int main(){
float c,f;
printf("Enter Temperature in centigrade:\n");
scanf("%f",&c);
f=9/5.0*c+32; //formula to convert centigrade to fahrenheit
printf("Temperature in fahrenheit is:%f",f);
return 0;

}

… 19 more words
Java

C program to return absolute value

C program to return absolute value like abs() function.

The program need one user input.


// C program to return absolute value like abs() function
//Author: Sani Kamal

#include<stdio.h>

int main(){
int user_abs(int);
int n;
printf("Enter a +VE/-VE number:\n");
scanf("%d",&n);
int result=user_abs(n);
printf("Absolute Value is:%d",result);
return 0;
}
// function to finding absolute value
user_abs(int x){
if(x<0)
return (x*-1);
return x;
}

… 9 more words
Pratice Problem

C Program to find sum of two number

//C program to find sum of two numbers.
#include<stdio.h>

int main(){
 int num1,num2,sum;
 printf("Enter two number:\n");
 scanf("%d%d",&num1,&num2);
 sum=num1+num2;
 printf("Summation is:%d",sum);
 return 0;
}

Output:

Enter two number:
34
5
Summation is:39
Pratice Problem

Stop yacking

Stop yacking

get to the work

stop day dreaming

get to the work

the day of yacking gone

the day of chatting up

were we so non-communicate… 92 more words