Skip to main content

ADD N NUMBERS

Add n numbers
#include < stdio.h >
int main()
{
  int n, sum = 0, c, value;
  printf("Enter the number of integers you want to add\n");
  scanf("%d", &n);
  printf("Enter %d integers\n",n);
  for (c = 1; c <= n; c++)
  {
  scanf("%d",&value);
  sum = sum + value;
  /*adding each no in sum*/
  }
  printf("Sum of entered integers = %d\n",sum);
  return 0;
}

Comments

Popular posts from this blog

SIMPLE INTEREST

Simple interest #include < stdio.h > void main() { int amount, rate, time, ans; printf("\nEnter Principal Amount : "); scanf("%d", &amount); printf("\nEnter Rate of Interest : "); scanf("%d", &rate); printf("\nEnter Period of Time : "); scanf("%d", &time); ans = (amount * rate * time)/100; /*Simple interest formula*/ printf("\nSimple Interest : %d",ans); }

HCF AND LCM

HCF and LCM #include < stdio.h > long gcd(long, long); int main() {   long x, y, hcf, lcm;   printf("Enter two integers\n");   scanf("%ld%ld", &x, &y);   hcf = gcd(x, y);   lcm = (x*y)/hcf;   printf("Greatest common divisor of %ld and %ld = %ld\n", x, y, hcf);   printf("Least common multiple of %ld and %ld = %ld\n", x, y, lcm);   return 0; } /*if 1st no is 0 then 2nd no is gcd make 2nd no 0 by subtracting smallest from largest and return 1st no as gcd*/ long gcd(long x, long y) {   if (x == 0) {   return y;   }   while (y != 0) {   if (x > y) {     x = x - y;   }   else {     y = y - x;   } } return x; }

System Software

System software Any programs that control the computers hardware or that can be used to maintain the computer in some way so that it runs more efficiently.These are 3 basic types of system software a.Operating System An operating system tells the computer how to use it own components.It is essential, Because it acts as an interface between the hardware, application program and the user Eg: Windows, Linux B.Network operating system Network operating system allows the computer to communicate and share data across a network while controlling network operation and network security. C.Utility Utility is a program that make the computer system easier to use and perform highly specialised function utilities are used to manage disk, trouble shoot hardware problems and perform other task.Operating system may not be able to do.