Strings in C language

string in c

Strings in ‘c’ are defined as a series of characters. The difference between a string and a string is that the string ends with a special character “\0”. Strings in c declaration: declaring a string is as simple as declaring a dimensional array. Below is the basic syntax for declaring a string. In the syntax … Read more

Write a C program to find that the accepted number is Negative, or Positive or Zero.

#include<stdio.h> int main() { int no; printf(“\n Enter any number : “); scanf(“%d”,&no); if(no==0) { printf(“\n Entered Number is Zero”); } else if(no>0) { printf(“\n Entered Number is Positive”); } else { printf(“\n Entered Number is Negative”); } return 0; }

Write a C program to find out distance travelled by the equation d = ut + at^2

#include<stdio.h> int main() {     float u,a,d;     int t;          printf(“\nEnter the value of a : “);     scanf(“%f”,&a);     printf(“\nEnter the value of u : “);     scanf(“%f”,&u);     printf(“\nEnter the value of t : “);     scanf(“%d”,&t);     d = (u … Read more

Write a program to compute from centigrade to Fahrenheit

centigrade to Fahrenheit  formula (f=1.8*c +32) #include <stdio.h> int main()  {  float F,C;  printf(“Enter Temperature in Celsius : ” );  scanf(“%f”,&C);  F = (C * 1.8) + 32;  printf(“\n %.2f Celsius = %.2f Fahrenheit”,C, F);  return 0; }   More C programs are here http://projugaadu.com/category/topics/c-language/

Write a C program to enter a distance into kilometers to meter to convert, feet, inches, and centimeter.

//kilometers to meter#include <stdio.h> int main()  {  float km;  printf(“Enter Length in KiloMeter : “);  scanf(“%f”,&km);  printf(“\n %.2f KM = %.2f Meters”,km,km*1000);  printf(“\n %.2f KM = %.2f Feets”,km,km*3280.84);  printf(“\n %.2f KM = %.2f Inches”,km,km*39370.08);  printf(“\n %.2f KM = %.2f Centimeters”,km,km*1000*100);  return 0; } you can find more c programs and things here http://projugaadu.com/category/topics/c-language/

Write a C program to swap two numbers

//swap two numbers#include <stdio.h> int main()  {  int a,b;  printf(“Enter Value of a :”);  scanf(“%d”,&a);  printf(“Enter Value of b :”);  scanf(“%d”,&b);  a=a+b;  b=a-b;  a=a-b;  printf(“\nAfter Swapping Values a = %d b = %d”,a,b);  return 0; } You can get more c program here http://projugaadu.com/category/topics/c-language/

Write a c program for addition subtraction multiplication and division using function

#include<stdio.h> int main() { int i,j; printf(“\n Enter 1st Integer Value :”); scanf(“%d”,&i); printf(“\n Enter 2nd Integer Value :”); scanf(“%d”,&j); printf(“\n addition : %d”,i+j); printf(“\n multiplication : %d”,i*j); printf(“\n division : %d”,i/j); printf(“\n subtraction : %d”,i-j); return 0; }

Write a program how to find area of triangles (a=h*b*.5) , Where a = area h = height b = base

// how to find area of triangles  #include<stdio.h>int main(){float a,h,b;printf(“\n Enter height :”);scanf(“%f”,&h);printf(“\n Enter base :”);scanf(“%f”,&b);a=b*h*0.5;printf(“\n Area of triangle = %f”,a);return 0;}   You can get more related c programs here http://projugaadu.com/category/topics/c-language/

Write a program to calculate simple interest (i = (p*r*n)/100) ,Where i = Simple interest , p = Principal amount , r = Rate of interest , n = Number of years

#include <stdio.h> int main()  {  int n;  float p, r, I;  printf(“\n Enter Amount p :”);  scanf(“%f”,&p);  printf(“\n Enter Rate r :”);  scanf(“%f”,&r);  printf(“\n Enter No of Years n :”);  scanf(“%d”,&n);  I = (p*r*n)/100;  printf(“\n Interest = %.2f”,I);  return 0; }