Skip to main content

Posts

Showing posts with the label c programs with solutions

100 C Programming Interview Questions With Answers - Technical Interview.

C Programs Frequently Asked In Interviews. This section covers C Programming Language questions often asked in campus interviews and freshers walk-in. This page will help job seekers who are about to attend TECHNICAL interview round . Here you will find simple C programming questions with answers basically asked in technical interviews . Click on any question to find out it's answers: 1) What is the difference between declaring a variable and defining a variable? 2) Define static variable? 3) What is a register variable? 4) Where is an auto variable stored? 5) What is meant by scope and storage allocation of a variable or function? 6) What is scope & storage allocation of extern and global variables? 7) What is scope & storage allocation of register? 8) What is scope & storage allocation of static and local variables? 9) What is the difference between 'break' and 'continue' statements? 10) W...

Sample C Program to convert given number of days to a measure of time given in years, weeks and days.

For example 375 days is equal to 1 year 1 week and 3 days (ignore leap year). # include <stdio.h> #define DAYSINWEEK 7 void main() {     int ndays, year, week, days;     printf("Enter the number of daysn");     scanf("%d", &ndays);     year = ndays / 365;     week =(ndays % 365) / DAYSINWEEK;     days =(ndays % 365) % DAYSINWEEK;     printf ("%d is equivalent to %d years, %d weeks and %d days", ndays, year, week, days); } Output: Enter the number of days 29 29 is equivalent to 0 years, 4 weeks and 1 days Enter the number of days 1000 1000 is equivalent to 2 years, 38 weeks and 4 days